Nginx+Gunicorn+Flask не работают на 81 порту
Я не могу запустить свой сервис на 81 порту на VPS Ubuntu Server 16.04./etc/hosts/
:
127.0.0.1 localhost
93.38.139.10 test.com test
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Системный сервис:
[Unit]
Description=Gunicorn instance to serve Auth service
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/var/www/auth
Environment="PATH=/var/www/auth/venv/bin"
ExecStart=/var/www/auth/venv/bin/gunicorn --access-logfile - --workers 3 --bind unix:viauth.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.target
Конфигурация сайта Nginx:
server {
listen 81;
listen [::]:81;
server_name 93.38.139.10;
location / {
include proxy_params;
proxy_pass http://unix:/var/www/auth/viauth.sock;
}
}
ufw status numbered
:
[ 1] 80/tcp ALLOW IN Anywhere
[ 2] 80 ALLOW IN Anywhere
[ 3] 443 ALLOW IN Anywhere
[ 4] 22 ALLOW IN Anywhere
[ 5] 53 ALLOW OUT Anywhere (out)
[ 6] Nginx Full ALLOW IN Anywhere
[ 7] 81/tcp ALLOW IN Anywhere
[ 8] 81 ALLOW IN Anywhere
[ 9] 80/tcp (v6) ALLOW IN Anywhere (v6)
[10] 80 (v6) ALLOW IN Anywhere (v6)
[11] 443 (v6) ALLOW IN Anywhere (v6)
[12] 22 (v6) ALLOW IN Anywhere (v6)
[13] 53 (v6) ALLOW OUT Anywhere (v6) (out)
[14] Nginx Full (v6) ALLOW IN Anywhere (v6)
[15] 81/tcp (v6) ALLOW IN Anywhere (v6)
[16] 81 (v6) ALLOW IN Anywhere (v6)
Он отлично работает, когда я переключаю конфигурацию сайта Nginx на 80-порт, но не на 81-порт.
Что может быть не так?
ДОБАВЛЕНО:
Состояние службы Systemd:
* viauth.service - Gunicorn instance to server Auth service
Loaded: loaded (/etc/systemd/system/viauth.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2018-09-25 23:25:11 UTC; 54min ago
Main PID: 3398 (gunicorn)
CGroup: /system.slice/viauth.service
|-3398 /var/www/auth/venv/bin/python3 /var/www/auth/venv/bin/gunicorn --workers 3 --bind unix:viauth.sock -m 007 wsg
|-3403 /var/www/auth/venv/bin/python3 /var/www/auth/venv/bin/gunicorn --workers 3 --bind unix:viauth.sock -m 007 wsg
|-3405 /var/www/auth/venv/bin/python3 /var/www/auth/venv/bin/gunicorn --workers 3 --bind unix:viauth.sock -m 007 wsg
`-3407 /var/www/auth/venv/bin/python3 /var/www/auth/venv/bin/gunicorn --workers 3 --bind unix:viauth.sock -m 007 wsg
Sep 25 23:25:11 test systemd[1]: Stopped Gunicorn instance to server Auth service.
Sep 25 23:25:11 test systemd[1]: Started Gunicorn instance to server Auth service.
Sep 25 23:25:11 test gunicorn[3398]: [2018-09-25 23:25:11 +0000] [3398] [INFO] Starting gunicorn 19.9.0
Sep 25 23:25:11 test gunicorn[3398]: [2018-09-25 23:25:11 +0000] [3398] [INFO] Listening at: unix:viauth.sock (3398)
Sep 25 23:25:11 test gunicorn[3398]: [2018-09-25 23:25:11 +0000] [3398] [INFO] Using worker: sync
Sep 25 23:25:11 test gunicorn[3398]: [2018-09-25 23:25:11 +0000] [3403] [INFO] Booting worker with pid: 3403
Sep 25 23:25:11 test gunicorn[3398]: [2018-09-25 23:25:11 +0000] [3405] [INFO] Booting worker with pid: 3405
Sep 25 23:25:11 test gunicorn[3398]: [2018-09-25 23:25:11 +0000] [3407] [INFO] Booting worker with pid: 3407
И статус nginx:
* nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/nginx.service.d
`-override.conf
Active: active (running) since Wed 2018-09-26 00:04:37 UTC; 18min ago
Process: 4286 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 4302 ExecStartPost=/bin/sleep 0.1 (code=exited, status=0/SUCCESS)
Process: 4298 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 4292 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 4301 (nginx)
CGroup: /system.slice/nginx.service
|-4301 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
`-4304 nginx: worker process
Sep 26 00:04:37 test systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 26 00:04:37 test systemd[1]: Started A high performance web server and a reverse proxy server.