若依反相代理

普通代理方式

location/{

root /root/workspace/ruoyi-ui/dist;

index  index.html index.htm;

}

location /prod-api/{

        proxy_set_header Host $http_host;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header REMOTE-HOST $remote_addr;

        proxy_set_header Host X-Forward-For $proxy_add_x_forwarded_for;

        proxy_pass http://192.168.31.101:8080/;

}

集群代理方式:

{

    listen 80;

sever_name localhost;

upstream ruoyi{

        server 192.168.31.101.8080 weight=5;

        server 192.168.31.102.8080  weight=3;

}


location /{

        root  /root/workspace/ruoyi-ui/dist;

        index index.html  index.html;

}


location /prod-api/{

proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header REMOTE-HOST $remote_addr;

proxy_set_header Host X-Forward-For $proxy_add_x_forwarded_for;

proxy_pass http://ruoyi/;

}

}

你可能感兴趣的:(若依反相代理)