运行gunicorn和nginx的Flask应用程序在重定向点崩溃

2024-06-28 20:30:03 发布

您现在位置:Python中文网/ 问答频道 /正文

你能帮忙吗?我被卡住了。在

当我的url为0.127时,返回('Icorn'I crash at'820.I.u.)wsgi:app。 当我使用supervisor运行它时,也会出现同样的问题。 当我正常运行时,代码运行良好,即python应用程序副本在

谢谢你的建议。在


Tags: app应用程序urlwsgi副本crash建议at
1条回答
网友
1楼 · 发布于 2024-06-28 20:30:03

尝试使用此配置,可能会对您有所帮助。 在/etc/nginx/sites enabled/

server {
        listen 80 ;
        server_name abc.com;
        large_client_header_buffers 8 32k;
  if ($http_user_agent ~* Googlebot) {  
    return 403; 
  }
        access_log /var/log/nginx/access.log;
        location / {
                add_header 'Access-Control-Allow-Origin' "$http_origin";
                add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';
                add_header 'Access-Control-Allow-Credentials' 'true';
                add_header 'Access-Control-Allow-Headers' 'User-Agent,Keep-Alive,Content-Type';
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass https://127.0.0.1:5000;
                proxy_read_timeout 90;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_buffers 8 32k;
                proxy_buffer_size 64k;
        }
}

使用

^{pr2}$

检查配置

相关问题 更多 >