when I don’t specify my port number in my url, static files are not loaded in that case.
It works fine for xyz.com:8000 all the static files are loaded But when i use xyz.com, it doesn’t load any static files.
I’m using nginx server.
this is my nginx configuration
server {
listen 80;
server_name santhals.com;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/ubuntu/santhals/myapp/;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
2
Answers
refer this may help?
Nginx serve static file and got 403 forbidden
I peeked into your work (sorry but I couldn’t help it) and browser said 403 forbidden.
Your
Nginx
configs look fine and if there are no permission and access issues, it should work.A few things to check:
django.contrib.staticfiles
is included in theINSTALLED_APPS
in yoursettings.py
file.STATIC_URL
andSTATIC_ROOT
variables are properly set in yoursettings.py
file. Generally, they should be pointing to thestatic
directory that is located in the root of your project.python manage.py collectstatic
before deploying your application