nginx 404解决

 

最近在公司配置https代理本地Java项目是老是访问404

原配置:

        location /wss {
            proxy_pass http://127.0.0.1:10826; # tomcat服务器地址
            proxy_set_header        Host $host;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header        X-Forwarded-Proto https;
            proxy_next_upstream     off;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
        }


nginx 404解决_第1张图片

老是报404找不到mapping错误

参照了这位兄台的博客发现了问题

https://blog.csdn.net/chenyidong521/article/details/78560794

于是改配置

地址末尾少了个  / 

nginx 404解决_第2张图片

        location /wss {
            proxy_pass http://127.0.0.1:10826/; # tomcat服务器地址
            proxy_set_header        Host $host;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header        X-Forwarded-Proto https;
            proxy_next_upstream     off;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
        }

你可能感兴趣的:(Java,nginx)