nginx代理配置

例如: http://11.11.11.1/api/getList ,这样的全部代理到 http://12.12.12.1:5000/api/getList

修改文件 /etc/nginx/conf.d/default.conf

location  ~ /api/ {
        proxy_pass http://12.12.12.1:5000; //这里需要注意,最后不要有反斜杠/
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   X-Real-IP         $remote_addr;
    }

重启服务,即可。

参考: https://blog.csdn.net/cxm19881208/article/details/65441750

(完)

原文地址:https://www.cnblogs.com/lishidefengchen/p/13177704.html