美文网首页
nginx 代理配置

nginx 代理配置

作者: 江火渔枫 | 来源:发表于2018-06-19 17:19 被阅读21次

    配置基于如下文件路径操作

    nginx安装路径: 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

    image.png
     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

    相关文章

      网友评论

          本文标题:nginx 代理配置

          本文链接:https://www.haomeiwen.com/subject/yyxzeftx.html