本文介绍: 访问会变成 www.test.com:8080/a访问会变成 www.test.com/a比如监听 www.test.com/a

需要location里面的最上面加上这些配置

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Range $http_range;
    proxy_set_header If-Range $http_if_range;
    proxy_redirect off;
    client_max_body_size 20000m;

比如监听 www.test.com/a

未加配置前   

location / {
        proxy_pass https://192.168.96.78:8080;
    }

访问会变成 www.test.com:8080/a

配置

    location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Range $http_range;
    proxy_set_header If-Range $http_if_range;
    proxy_redirect off;
    client_max_body_size 20000m;
        proxy_pass https://192.168.96.78:8080;
    }

访问会变成 www.test.com/a

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注