【Nginx】将您重定向的次数过多


如果项目根路径不为空,需要多做一层映射,防止前后端来回重定向;

    server{
        listen        80;
        server_name   pmp.mussessein.cn;
        
        location / {
            root   html;
            proxy_pass  http://127.0.0.1:9000/pmp;
            proxy_redirect off;
            proxy_set_header     Host  $host;
            proxy_set_header      ROMOTE_ADDR  $remote_addr;
            proxy_set_header     X-Forwarded-For  $proxy_add_x_forwarded_for;
            real_ip_header    X-Forwarded-For;
            real_ip_recursive   on;
        }
        location /pmp {
            root   html;
            proxy_redirect off;
            proxy_set_header     Host  $host;
            proxy_set_header      ROMOTE_ADDR  $remote_addr;
            proxy_set_header     X-Forwarded-For  $proxy_add_x_forwarded_for;
            real_ip_header    X-Forwarded-For;
            real_ip_recursive   on;
            proxy_pass  http://127.0.0.1:9000/pmp;
            index  index.html index.htm;
        }
        location = /50x.html{
            root  html;
        }
    }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM