标签:反向代理 listen 添加 配置 图片 name site html 配置nginx
配置nginx反向代理,实现api.x.com域名代理本地9001端口1、编辑hosts文件
192.168.43.157 api.x.com
2、编辑配置,http{}中添加配置:
server {
listen 80;
server_name api.x.com;
location / {
proxy_pass http://127.0.0.1:9001/;
}
}
server {
listen 9001;
root /data/site1/api;
location / {
index index.html;
}
}
3、重新加载配置:
nginx -s reload
4、效果:
标签:反向代理 listen 添加 配置 图片 name site html 配置nginx
原文地址:https://blog.51cto.com/5440126/2498112