有时候我们需要设定一个域名跳转到另一个网址,可以直接在nginx配置文件中指定。
参考下面的配置:
输入www.baidu.com,
返回状态码302。
之后跳转到https://www.ipaddr.host/index-1.html
nginx302跳转

server {
        server_name www.baidu.com;
        location = / {
                rewrite ^ https://www.ipaddr.host/index-1.html redirect;
        }

}