Nginx Reverse proxy to remove port number

2019-09-21 13:24发布

问题:

Need windows server setting to map the port domain

abc.com:8145 to abc.com server {listen 8145; server_name abc.com;}

Need server and location config to reverse proxy it

can anyone provide the working example of redirecting website

回答1:

server {
    listen 80;
    server_name abc.com
    location / {
        proxy_pass http://127.0.0.1:8145;   // the IP is your server ip.
        proxy_set_header Host $host;  //abc.com
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

}