【问题标题】:nginx not deploying at other locationsnginx 未部署在其他位置
【发布时间】:2017-08-09 19:52:53
【问题描述】:

这是我的 .conf 文件,用于我的 nginx 服务器部署带有 gunicorn 的烧瓶应用程序,它可以在 mysite.xyz 上完美运行想办法。我尝试将location / { 更改为location /app { 无济于事。

server {
    listen 80;
    server_name mysite.xyz;

    location / {
        include proxy_params;
        proxy_pass http://unix:/var/www/app/app.sock;
    }
}

【问题讨论】:

    标签: nginx flask gunicorn


    【解决方案1】:

    尝试编辑位置,类似的东西;还有为什么你不使用 fastcgi_pass

    server {
        listen 80;
        server_name mysite.xyz;
    
    location / {
    
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.html;
        }
    
    location /app {
            include proxy_params;
            proxy_pass http://unix:/var/www/app/app.sock:/app;
        }
    }
    

    【讨论】:

    • 这似乎不起作用。 :/ 当我访问 mysite.xyz/app 时,我收到了 The requested URL was not found on the server.
    • nvm,现在一切正常,必须将我的烧瓶文件更改为以 /app/ 而不是 / 开头
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-08
    • 1970-01-01
    相关资源
    最近更新 更多