Nginx Django Uwsgi Page Not Found Error
I am trying to setup uwsgi and Django on Nginx but showing page not found error and error logs are empty. I cannot identify the error because the error logs are empty. Error log /
Solution 1:
You need to install python plugin for uwsgi
sudo apt-get install uwsgi-plugin-python
or for python 3
sudo apt-get install uwsgi-plugin-python3
Solution 2:
You are running your project using port 8080 with this code:
uwsgi --http :8080 --home /home/flybegins/python/django/venv/ --chdir /home/flybegins/python/django/sample -w sample.wsgi
And you are trying to bind NGINX to a socket file that doesn't exist using this configuration:
location / {
include uwsgi_params;
uwsgi_pass unix:/home/flybegins/python/django/sample/sample.sock;
}
That why it doesn't work.
Solution 3:
I did two mistakes One is nginx virtual host configuration and another one is socket permission error
uWSGI Configuration
[uwsgi]project = prd
base = /home/flybegins/python/django
chdir = %(base)/%(project)
home = %(base)/venv
module = %(project).wsgi:application
master = trueprocesses = 5gid = www-data
uid = www-data
socket = /var/uwsgi/%(project).sock
chmod-socket = 664vacuum = true
To create the space for the socket to exist, you just have to pick a persistent directory (e.g. not /run or /tmp) and make www-data (the user nginx runs as) the owner of it, as such:
$ sudo mkdir /var/uwsgi$ sudo chown www-data:www-data /var/uwsgi
My nginx virtual host configuration
server {
listen 80;
server_name testserver1.com;
access_log /home/flybegins/log/python/testserver1.com/access.log;
error_log /home/flybegins/log/python/testserver1.com/error.log error;
location /static {
alias /home/flybegins/python/django/prd/static_files/;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/var/uwsgi/prd.sock;
}
}
Post a Comment for "Nginx Django Uwsgi Page Not Found Error"