Nginx +插槽+烧瓶出现问题。握手后504

时间:2020-02-17 10:03:30

标签: nginx flask-socketio

很多天试图设置nginx + socketio + flask。解决了许多不同的问题后,我得到了一个我在google中找不到的问题(也许我有点笨,但仍然:))。 启动所有服务(uWSGI + Nginx)后,我的应用程序变得可用,并且一切正常。 Socketio握手,得到响应200。仍然可以。之后,长时间轮询(xhr)请求开始出现504错误。在nginx错误日志中,我看到已发送ping但未收到pong ...之后,任何请求开始获取504 ...

请帮助,我对错误之处没有更多的想法...

我的设置:

/ etc / nginx / sites-avaliable / myproject

element.parentNode

/etc/systemd/system/myproject.service

from io import StringIO

file1 = '''\
>15_48499991_ENSG00000074803_C_G_G
CCAATCGCTTTCAAGTTAGTGTG
>15_48499991_ENSG00000074803_C_G_G
CAATCGCTTTCAAGTTAGTGTGA
>15_48499991_ENSG00000074803_C_G_G
AATCGCTTTCAAGTTAGTGTGAT
'''

file2 = '''\
CCAATCGCTTTCAAGTTAGTGTG -14.48
CAATCGCTTTCAAGTTAGTGTGA -29.94
AATCGCTTTCAAGTTAGTGTGAT -20.58
'''

# Create a look-up table from first file.
map = {}
with StringIO(file1) as file:  # Open file1.
    for line in file:
        first = line.rstrip()[1:]  # Remove leading '>'.
        second = next(file).rstrip()
        map[second] = first

# Output matches in desired format.
with StringIO(file2) as file:  # Open file2.
    for line in file:
        first, second = line.split()
        print(f'{map[first]}    {first}    {second}')

/home/myproject/ftp/files/uwsgi.ini

server {
    listen 80;
    server_name mydomen.ru;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/home/myproject/ftp/files/myproject.sock;
    }

    location /socket.io/ {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection ‘’upgrade’’;
        include uwsgi_params;
        uwsgi_pass unix:/home/myproject/ftp/files/myproject.sock;
    }
}

0 个答案:

没有答案