Eujene
@Eujene
Айти или не айти?

Где ошибка в конфиге uwsgi?

Здравствуйте.

Настраиваю связку uwsgi + nginx по https://www.digitalocean.com/community/tutorials/h...

Nginx выдает ошибку 502

Уверен, что не правильно настроил uwsgi, но где не могу понять:

cat /etc/uwsgi/lottery_service/lottery_service.ini 
[uwsgi]
project = lottery_service_backend
uid = lottery_service
base = /home/%(uid)/lottery_service



chdir = %(base)/%(project)
home = %(base)/lottery_service_venv/
module = %(project).wsgi:application

master = true
processes = 5


socket = /run/uwsgi/%(project).sock
chown-socket = %(uid):www-data
chmod-socket = 664
vacuum = true


Думаю, что здесь нужно иначе настроить строку ExecStartPre:

cat /etc/systemd/system/uwsgi.service 
[Unit]
Description = uWSGI Emperor service

[Service]

ExecStartPre=/bin/bash -c 'mkdir -p /run/uwsgi; chown lottery_service:www-data /run/uwsgi'
ExecStart=/usr/local/bin/uwsgi --emperor /etc/uwsgi/sites
Restart=always
KillSignal=SIGQUIT

[Install]
WantedBy=multi-user.target


Журнал пишет следующее:
Feb 14 19:18:35 31750 uwsgi[22939]: [emperor] *** RAGNAROK EVOKED ***
Feb 14 19:18:35 31750 uwsgi[22939]: Thu Feb 14 19:18:35 2019 - The Emperor is buried.
Feb 14 19:18:35 31750 systemd[1]: Stopping uWSGI Emperor service...
Feb 14 19:18:35 31750 systemd[1]: Stopped uWSGI Emperor service.
Feb 14 19:18:35 31750 systemd[1]: Starting uWSGI Emperor service...
Feb 14 19:18:35 31750 systemd[1]: Started uWSGI Emperor service.
Feb 14 19:18:35 31750 uwsgi[23330]: *** Starting uWSGI 2.0.17.1 (64bit) on [Thu Feb 14 19:18:35 2019] ***
Feb 14 19:18:35 31750 uwsgi[23330]: compiled with version: 7.3.0 on 07 February 2019 07:30:30
Feb 14 19:18:35 31750 uwsgi[23330]: os: Linux-4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019
Feb 14 19:18:35 31750 uwsgi[23330]: nodename: 31750
Feb 14 19:18:35 31750 uwsgi[23330]: machine: x86_64
Feb 14 19:18:35 31750 uwsgi[23330]: clock source: unix
Feb 14 19:18:35 31750 uwsgi[23330]: pcre jit disabled
Feb 14 19:18:35 31750 uwsgi[23330]: detected number of CPU cores: 1
Feb 14 19:18:35 31750 uwsgi[23330]: current working directory: /
Feb 14 19:18:35 31750 uwsgi[23330]: detected binary path: /usr/local/bin/uwsgi
Feb 14 19:18:35 31750 uwsgi[23330]: uWSGI running as root, you can use --uid/--gid/--chroot options
Feb 14 19:18:35 31750 uwsgi[23330]: *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Feb 14 19:18:35 31750 uwsgi[23330]: *** WARNING: you are running uWSGI without its master process manager ***
Feb 14 19:18:35 31750 uwsgi[23330]: your processes number limit is 7751
Feb 14 19:18:35 31750 uwsgi[23330]: your memory page size is 4096 bytes
Feb 14 19:18:35 31750 uwsgi[23330]: detected max file descriptor number: 1024
Feb 14 19:18:35 31750 uwsgi[23330]: *** starting uWSGI Emperor ***

sudo systemctl status uwsgi.service 
● uwsgi.service - uWSGI Emperor service
   Loaded: loaded (/etc/systemd/system/uwsgi.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-02-14 19:18:35 MSK; 13min ago
  Process: 23326 ExecStartPre=/bin/bash -c mkdir -p /run/uwsgi; chown lottery_service:www-data /run/uwsgi (code=exited, status=0/SUCCESS)
 Main PID: 23330 (uwsgi)
    Tasks: 1 (limit: 2325)
   CGroup: /system.slice/uwsgi.service
           └─23330 /usr/local/bin/uwsgi --emperor /etc/uwsgi/sites

Feb 14 19:18:35 31750 uwsgi[23330]: detected number of CPU cores: 1
Feb 14 19:18:35 31750 uwsgi[23330]: current working directory: /
Feb 14 19:18:35 31750 uwsgi[23330]: detected binary path: /usr/local/bin/uwsgi
Feb 14 19:18:35 31750 uwsgi[23330]: uWSGI running as root, you can use --uid/--gid/--chroot options
Feb 14 19:18:35 31750 uwsgi[23330]: *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Feb 14 19:18:35 31750 uwsgi[23330]: *** WARNING: you are running uWSGI without its master process manager ***
Feb 14 19:18:35 31750 uwsgi[23330]: your processes number limit is 7751
Feb 14 19:18:35 31750 uwsgi[23330]: your memory page size is 4096 bytes
Feb 14 19:18:35 31750 uwsgi[23330]: detected max file descriptor number: 1024
Feb 14 19:18:35 31750 uwsgi[23330]: *** starting uWSGI Emperor ***
  • Вопрос задан
  • 216 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы