- Create a file
vim /etc/nginx/sites-available/<filename>
- Paste below content and edit accordingly
server { listen 80; server_name test.django.com; location /static/ { root /var/www/test.django.com/; } location / { proxy_pass http://127.0.0.1:8080/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
- create a smlink to sites-enabled
sudo ln -s /etc/nginx/sites-available/<filename> /etc/nginx/sites-enabled
- Check nginx configuration and reload
sudo nginx -t sudo service nginx reload
Last active
June 1, 2018 06:58
-
-
Save paneru-rajan/2e3fd4aa9044ead21e2061027ee8dff4 to your computer and use it in GitHub Desktop.
[Nginx configuration for django] It serves static file from different folder #nginx #django #proxy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment