作者:Eddy  历史版本:1  更新时间:2024-05-13 18:33

编写版本:v3.5.0
适用版本:所有版本

代理是不允许出现下划线,否则会报400

如:

    location /ibps/ {        
        proxy_pass    http://ibps_gateway:15100/ibps/;
    }

解决方式:将主机名或域名通过upstream包装一层

upstream gateway {
    server ibps_gateway:15100 weight=2;
}

server {
    listen        80;
    server_name    localhost;
    location / {
        root    html;
        index    index.html index.htm;
    }

    location /ibps/ {
        proxy_pass    http://gateway/ibps/;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}