GPT4.0+Midjourney绘画+国内大模型 会员永久免费使用!
 【 如果你想靠AI翻身,你先需要一个靠谱的工具! 】
nginx 由以下几部分组成

proxy_pass指令可以根据规则代理到proxy_pass后的url地址

server_name 用于定义哪些url使用此规则
将gulimaill.com 下所有请求进行代理
负载均衡语法如下 upstream定义于在均衡服务器 proxy_pass使用负载均衡服务器
可以使用此方法代理网关
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | http {    upstream myapp1 {        server srv1.example.com;        server srv2.example.com;        server srv3.example.com;    }    server {        listen 80;        location / {            proxy_pass http://myapp1;        }} | 
| 1 2 3 4 5 6 7 8 | upstream gulimall {      server 192.168.1.7:10001;  }      location / {              proxy_set_header Host $host;              # proxy_pass http://192.168.1.7:10000;              proxy_pass http://gulimall;      } | 
然后配置gateway
当url为***.gulimaill.com的话 跳转至商品服务

此处有坑 因为nginx不会携带Host请求头 所有还得添加proxy_set_header Host $host;配置
到此这篇关于nginx反向代理 的文章就介绍到这了,更多相关nginx反向代理 内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!