【问题标题】:Nginx error_page 404 proxy_passNginx error_page 404 proxy_pass
【发布时间】:2020-10-30 22:13:06
【问题描述】:

有人可以帮我解决这个问题吗?

我在使用 proxypass 的主机中使用 gunicorn 使用烧瓶应用程序配置 Nginx。访问该路径时出现 404 Page not found 错误。

这是我的 Nginx 配置:

server {
    listen 80;
    server_name xxxx.com www.xxxx.com;
    return 301 https://$server_name$request_uri;
}
server {
    listen 443 ssl;
    server_name xxxx.com www.xxxx.com;
    ssl_certificate     xxxxxx;
    ssl_certificate_key  xxxxxx;

    location / {
        include proxy_params;
        proxy_pass http://unix:/xxxx/app.sock;
        }
    location = /dev{
        proxy_pass http://unix:/xxxx/app.sock;
        include proxy_params;
    }
}

如果我在 home(xxxx.com) 中配置并访问其工作的主目录,但是当我尝试在 path(xxxx.com/dev) 中配置并访问此 http://xxxxx.com/dev 时出现 404 错误.我的实际应用在 /home/path/to/folder/app.sock

请帮帮我。

谢谢。

【问题讨论】:

    标签: python nginx


    【解决方案1】:
    location /dev {
            include proxy_params;
            rewrite ^/dev(.*)$ /$1 break;
            proxy_pass http://unix:/path/to/folder/dev.sock;
        }
    

    为我工作。

    谢谢。

    【讨论】:

      猜你喜欢
      • 2018-10-11
      • 2023-04-03
      • 2022-11-03
      • 1970-01-01
      • 2013-12-30
      • 2013-04-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多