【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;
        }
    }
posted @ 2020-07-23 03:50  mussessein  阅读(11567)  评论(0编辑  收藏  举报