Glam Prestige Journal

Bright entertainment trends with youth appeal.

I'm working through How To Serve Django Applications with uWSGI and Nginx on Ubuntu 16.04.

I have completed the tut and restarted both nginx and uwsgi. I notice that if I go to the IP of my server, I see my site (making me think that uwsgi is working properly). However if I go to , I get the 502 error. My nginx config file in the /etc/nginx/sites-available is mysite contains:

server {
listen 80;
server_name mysite.com
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ { root /home/deploy/mysite;
}
location / { include uwsgi_params; uwsgi_pass unix:/run/uwsgi/mysite.sock;
}

What am I doing wrong?

$ systemctl status uwsgi
Failed to connect to bus: No such file or directory

I'm confused, I know I have been working on a number of uwsgi files and

$ sudo systemctl start uwsgi 

does not cause an error. Also the website is still being served at the IP address. I thought uwsgi was doing that.

$ netstat -a|grep uwsgi
unix 2 [ ACC ] STREAM LISTENING 2373238691 /run/uwsgi/mysite.sock
1

2 Answers

The 502 Bad Gateway error means server is not getting proper response from another server. In your case it is uWSGI server. It is either not running or stopped due to error.

Check the status of uWSGI server by using sudo systemctl status uwsgi.

0

In php7 www-conf is in: /etc/php/7.0/fpm/pool.d

In this file I find this:

; Note: This value is mandatory.
listen = /run/php/php7.0-fpm.sock
; Set listen(2) backlog.

I set a parameter in /etc/nginx/sites-available/[site]

upstream php-handler { #server 127.0.0.1:9000; server unix:/run/php/php7.0-fpm.sock;
}

And it's working :)

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy