Nginx隐藏代理端口
使用Nginx将请求的80端口代理到后端3000端口上,并隐藏端口 隐藏端口需要下面两行:
server_name_in_redirect off;
proxy_set_header Host $host:$server_port;
配置示例如下:
server {
listen 80;
server_name www.yiyi.company yiyi.company;
server_name_in_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass http://www.yiyi.company:3000;
}
}