1、需求
浏览器访问80端口,要把请求转发至8882
2、实现
修改ngixn配置文件
ngin配置文件在nginx安装目录/nginx/conf文件夹下
cd /usr/local/nginx/conf
vi ngin.conf
修改server配置
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8882;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}