注意:
在设置 Nginx 重定向之前要先安装 Nginx
正文:
# vi /usr/local/nginx/conf/nginx.conf
将部分内容修改如下:
......
http {
.....
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name 172.16.0.228;
......
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
......
}
......
}
(
补充:这里以
1) 将 server_name 设置为 172.16.0.228
2) 监听 80 端口
3) 将 8000 端口转发到 80 端口为例
)