简体   繁体   中英

Nginx error_page 404 proxy_pass

Can someone please help me on this.

I am configuring Nginx with flask app using gunicorn in a host using proxypass. While accessing that path i am getting 404 Page not found error.

Here is my Nginx config:

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;
    }
}

If i configure in home(xxxx.com) and access the home its working but when i tried to configure in path(xxxx.com/dev) and access this http://xxxxx.com/dev getting 404 error. My actual application is in /home/path/to/folder/app.sock

Please help me on this.

Thank you.

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

Works for me.

Thank you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM