1

I'm working through this article : How To Serve Django Applications with uWSGI and Nginx on Ubuntu 16.04 | DigitalOcean .

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 as expected. However if I go to www.mysite.com ,I get a 502 error.

I'm now suspecting the problem to be with uwsgi, because:

deploy@server:/etc/systemd/system$ systemctl stop uwsgi
Failed to connect to bus: No such file or directory
deploy@server:/etc/systemd/system$ systemctl start uwsgi
Failed to connect to bus: No such file or directory
deploy@server:/etc/systemd/system$ ps -aux |grep uwsgi
root     29993  0.0  0.5  84112  4344 ?        Ss   10:43   0:00 /usr/local/bin uwsgi --emperor /etc/uwsgi/sites
deploy   29996  0.0  3.9 136220 31364 ?        S    10:43   0:01 /usr/local/bin uwsgi --ini mysite.ini
deploy   29999  0.0  3.7 138888 29820 ?        S    10:43   0:02 /usr/local/bin uwsgi --ini mysite.ini
deploy   30000  0.0  3.2 136220 25496 ?        S    10:43   0:00 /usr/local/bin uwsgi --ini mysite.ini
deploy   30001  0.0  3.2 136220 25496 ?        S    10:43   0:00 /usr/local/bin uwsgi --ini mysite.ini
deploy   30002  0.0  3.2 136220 25496 ?        S    10:43   0:00 /usr/local/bin uwsgi --ini mysite.ini
deploy   30003  0.0  3.7 138328 29368 ?        S    10:43   0:00 /usr/local/bin uwsgi --ini mysite.ini
deploy   32311  0.0  0.1  11228   876 pts/0    S+   15:41   0:00 grep --color=auto uwsgi

Based on the tut the uwsgi unit file is:

[Unit]
Description=uWSGI Emperor service

[Service]
ExecStartPre=/bin/bash -c 'mkdir -p /run/uwsgi; chown deploy:www-data /run/uwsgi'
ExecStart=/usr/local/bin/uwsgi --emperor /etc/uwsgi/sites
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all

[Install]
WantedBy=multi-user.target

Why does systemd not control uwsgi?

Edit: I've realized that at least part of the problem is path related. I have anaconda installed and a :

deploy@server:~$ which uwsgi
/home/deploy/miniconda2/bin/uwsgi

I made a change to:

[Service]
ExecStartPre=/bin/bash -c 'mkdir -p /run/uwsgi; chown deploy:www-data /run/uwsgi'
ExecStart=/home/deploy/miniconda2/bin/uwsgi --emperor /etc/uwsgi/sites

closed the shell and reopened. I'm still getting:

deploy@server:~$ systemctl start uwsgi
Failed to connect to bus: No such file or directory
user1592380
  • 1,905

1 Answers1

2

systemctl should be used run as root or with sudo systemctl.

PD: Same answer for the question you deleted.

bistoco
  • 1,541