nginx + uwsgi + django problem

Hi

I'm trying to host a couple of sites (some django, some node.js, some static) on a Linode using nginx.

To config the django site, I used this guide ~~[https://library.linode.com/web-servers/nginx/python-uwsgi/ubuntu-12.04-precise-pangolin" target="_blank">](https://library.linode.com/web-servers/ … e-pangolin">https://library.linode.com/web-servers/nginx/python-uwsgi/ubuntu-12.04-precise-pangolin](. The default sites (static page) is available, while site configured following the guide give me an error 502.

In log I have this error:

2014/06/12 00:17:17 [crit] 10261#0: *1 connect() to unix:///run/uwsgi/app/alessandroamoroso.com/alessandroamoroso.socket failed (2: No such file or directory) while connecting to upstream, client: 79.56.27.44, server: alessandroamoroso.com, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///run/uwsgi/app/alessandroamoroso.com/alessandroamoroso.socket:", host: "<ip>:8080"</ip> 

This is the configuration in /etc/nginx/sites-available:

server {
        listen 8080 default_server;
        listen [::]:8080 default_server ipv6only=on;

        # Make site accessible from http://localhost/
        #server_name localhost;
        server_name alessandroamoroso.com www.alessandroamoroso.com;
        access_log /srv/www/alessandroamoroso.com/logs/access.log;
        error_log /srv/www/alessandroamoroso.com/logs/error.log;

        location / {
            #uwsgi_pass      127.0.0.1:8001;
            uwsgi_pass      unix:///run/uwsgi/app/alessandroamoroso.com/alessandroamoroso.socket;
            include         uwsgi_params;
            uwsgi_param     UWSGI_SCHEME $scheme;
            uwsgi_param     SERVER_SOFTWARE    nginx/$nginx_version;

        }

        location /static {
            root   /srv/www/alessandroamoroso.com/public_html/static/;
            index  index.html index.htm;

        }
}

Has anyone had a similar problem? Does anybody know tell me some other guide to follow?

Thanks

1 Reply

It looks to me like uWSGI is not running, or at least it's not listening to the same socket that you specify in your Nginx config.

In the link you provided to linode library guide make sure you were also following the steps in the section Configuring uWSGI and make sure the configuration file line that looks like this in the guide:

<socket>/run/uwsgi/app/example.com/example.com.socket</socket>

matches the path in your Nginx config.

Also make sure you run this command (as shown in that section of the guide):

service uwsgi restart

to make sure uWSGI is running.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct