nginx域名跳轉

[root@wjh2 ~]# vi /usr/local/nginx/conf/vhosts/discuz.conf #打開虛擬主機配置文件#php

加入如下配置:html

servernginx

{測試

listen 80;.net

server_name www.123.com www.456.com www.789.com;server

#域名跳轉htm

if ($host != 'www.123.com')get

{域名

rewrite ^/(.*)$ http://www.123.com/$1 permanent;it

}

index index.html index.htm index.php;

root /discuz/www;

[root@wjh1 ~]# service nginx configtest;

[root@wjh1 ~]# service nginx reload

測試:

相關文章
相關標籤/搜索