I have a Django
project that works using setup Django
web-server. I want to use nginx
and uWSGI
. I created a directory in root Django
folder called nginx/nginx.conf
and nginx/default.conf
to set nginx
. Ir successfully works at http://localhost:8080
and shows nginx start page (site also starts with uwsgi --http :8000 --module brand_site.wsgi
). But when I try http://localhost:8080/blog/corgifume-posts/
it shows 404 Not Found
. What’s the problem? Why my site doesn’t work with nginx
?
nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
include /opt/homebrew/etc/nginx/uwsgi_params; # where my uwsgi_param stores in local machine
server_tokens off;
include /opt/homebrew/etc/nginx/default.conf;
}
default.conf
server {
listen 8080; # what port to listen
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8000; # where to address requests
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
uwsgi.ini
[uwsgi]
wsgi-file = config/wsgi.py
strict = true
socket = :8000
protocol = http
master = true
no-orphans = true
die-on-term = true
lazy-apps = true
processes = 4
threads = 8
enable-threads = true
max-requests = 500
reload-on-rss = 1024
worker-reload-mercy = 60
harakiri = 60
harakiri-verbose = true
vacuum = true
post-buffering = 1048576
buffer-size = 65535
The path to my website: /Users/nnhufg/Desktop/CORGIFUME/brand_site
Артём Шепталин is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.