How to run django on localhost with nginx and uwsgi?
- by user2426362
How to run django on localhost with nginx and uwsgi?
This im my config but not works.
nginx:
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost_access.log;
error_log /var/log/nginx/localhost_error.log;
location / {
uwsgi_pass unix:///tmp/localhost.sock;
include uwsgi_params;
}
location /media/ {
alias /home/user/projects/zt/myproject/myproject/media/;
}
location /static/ {
alias /home/user/projects/zt/myproject/myproject/static/;
}
}
uwsgi:
[uwsgi]
vhost = true
plugins = python
socket = /tmp/localhost.sock
master = true
enable-threads = true
processes = 2
wsgi-file = /home/user/projects/zt/myproject/myproject/wsgi.py
virtualenv = /home/user/projects/zt
chdir = /home/user/projects/zt/myproject
touch-reload = /home/user/projects/zt/myproject/reload
This config work on my ubuntu server with normal domain (not localhost) but on localhost not working. If I run localhost in web browser I have
Welcome to nginx!