nginx去除端口号,反向代理
-
在nginx.conf文件所在位置创建一个文件加conf.d
-
在conf.d文件下创建一个文件reverse_proxy.conf
server
{
listen 80;
server_name shop.lv.com(原先nginx.conf配置里面需要去除端口号的server_name);
location / {
proxy_redirect off;
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_pass http://localhost:8086(原先的地址);
}
}