Z
Z
zkweb2015-08-18 17:43:51
Django
zkweb, 2015-08-18 17:43:51

How to fix error with Uwsgi + Nginx?

sudo service nginx restart
Restarting nginx: [emerg]: unknown directive "uwsgi_pass" in /etc/nginx/sites-enabled/project:16
configuration file /etc/nginx/nginx.conf test failed

#project.nginx
server {
       listen 8080;
       server_name localhost;
       access_log /var/log/nginx/nginx-testprj-access.log;
       error_log /var/log/nginx/nginx-testprj-error.log;

       root /var/www/nginx-default/project/django/project/;

       location / {
             	try_files $uri /static/$uri
        @django_uwsgi;
       		}

       location / {
     	 uwsgi_pass django;
     	 include uwsgi_params;
     	}
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
TyzhSysAdmin, 2015-08-18
@POS_troi

We study carefully.
habrahabr.ru/post/226419

S
sim3x, 2015-08-18
@sim3x

add at the beginning

upstream django {
    # server unix:///path/to/your/mysite/mysite.sock; # взаимодействие с uwsgi через Unix-сокет (мы воспользуемся этим вариантом позже) 
    server 127.0.0.1:8001; # взаимодействие с uwsgi через веб-порт 
}

to correct
location / {
             	try_files $uri /static/$uri   @django_uwsgi;
       		}

       location django_uwsgi {
     	 uwsgi_pass django;
     	 include uwsgi_params;
     	}

UPD
add of nginx repository nginx.org/en/linux_packages.html
remove old version
apt-get update
install new one

A
Andrey Burov, 2015-08-18
@BuriK666

you have nginx built without ngx_http_uwsgi_module .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question