两种方式,在server段中进行判断,或直接另外针对要转向的域名写server段,最后用rewrite ^/(.*)$ http://目标网址/$1 permanent; 跳转。如: server { server_name www.wgjlb.com wgjlb.com ; if ($host != 'www.w4s.cn' ) { rewrite ^/(.*)$ http://www.wgjlb.com/$1 permanent; } ... } server { server_name w4s.cn; rewrite ^/(.*) http://www.wgjlb.com/$1 permanent; }(责任编辑:IT) |