4324234 发表于 2017-1-9 16:32:09

nginx的域名跳转

域名跳转的配置如下:

1
2
3
   if ($host != 'www.test.com') {
      rewrite ^/(.*)$ http://www.test.com/$1 permanent;
    }




可以用curl测试。如下:

1
2
3
4
5
6
7
8
# curl -x127.0.0.1:80www.123.com -I
HTTP/1.1 301 Moved Permanently
Server: nginx/1.4.4
Date: Wed, 04 Jan 2017 05:46:14 GMT
Content-Type: text/html
Content-Length: 184
Connection: keep-alive
Location: http://www.test.com/






页: [1]
查看完整版本: nginx的域名跳转