Question
Nginx fails to load static files
I am following this tutorial to deploy my Django website: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-local-django-app-to-a-vps.
I am able to connect to the site using gunicorn, but all of my pages are displayed without any static content (css, javascript.)
Here is my nginx configuration file for the site.
server {
server_name [DROPLET IP ADDRESS];
access_log off;
location /static/ {
alias /home/myuser/myvirtualenv/myproject/static/;
}
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×