配置基于如下文件路径操作
image.pngnginx安装路径: D:\nginx-1.15.0
项目路径: D:\nginxServer\alert
代理接口: http://172.21.105.1:8090/export/data/list
新建配置文件: D:\nginx-1.15.0\conf\test.conf
include D:\\nginx-1.15.0\\conf\\test.conf;
image.png
server {
listen 8088;
server_name localhost;
error_log logs/xhpic_error.log debug;
access_log logs/xhpic_access.log;
#add_header Access-Control-Allow-Origin *;
location /export {
proxy_pass http://172.21.105.1:8090;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / {
root D:/nginxServer;
index index.html index.htm;
}
}
访问http://localhost:8088/export/data/list
获取的数据为http://172.21.105.1:8090/export/data/list
网友评论