nginx 设置多重代理,通过域名访问,有些请求301跳转加上了端口号
浏览器访问http://test.i18n.io/doc/guide 出现301跳转 http://test.i18n.io:8888/doc/guide导致
访问失败
nginx配置如下:
server{
listen 80;
server_name test.i18n.io;
access_log /opt/sc/nginx/log/nginx_access_sendcloud-i18n.log main;
error_log /opt/sc/nginx/log/nginx_error_sendcloud-i18n.log error;
client_max_body_size 100m;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off
location / {
proxy_pass http://192.168.10.12:8888;
}
}
更改
server{
listen 80;
server_name test.i18n.io;
access_log /opt/sc/nginx/log/nginx_access_i18n.log main;
error_log /opt/sc/nginx/log/nginx_error_i18n.log error;
client_max_body_size 100m;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
location / {
proxy_pass http://192.168.10.12:8888;
proxy_redirect http://test.i18n.io:8888/ /;
}
}