nginx - Please tell me how to write the configuration when https://api.***.com implicitly jumps to https://www.***.com/api/ with parameters.
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-16 17:07:01
0
4
661

Please tell me how to write the configuration when https://api.XXX.com implicitly jumps to https://www.XXX.com/api/ with parameters

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(4)
小葫芦

rewrite ^/(.*)$ https://www.XXX.com/api/$1 permanent;

曾经蜡笔没有小新

The reverse proxy can be configured on api..com to point to www..com/api/

伊谢尔伦
server {
    ...
    server_name api.xxx.com;
    location / {
        proxy_pass www.xxx.com/api/;
    }
}
伊谢尔伦

It is recommended to use nginx proxy and open nginx.conf

Add a new server block

server {
    server_name api.xxx.com;
    location / {
        proxy_pass www.xxx.com/api/;
    }
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template