Nginx域名跳转

nginx域名跳转
[root@wqslinux ~]# vim/usr/local/nginx/conf/vhosts/111.conf
server
{
listen 80;
server_name www.111.com www.bbb.com; //增加新的域名
if ($host !=”www.111.com”) //当不等于www.111.com
{
rewrite ^/(.*)$ http://www.111.com/$1 permanent; //跳转到www.111.com
}
检查语法
/usr/local/nginx/sbin/nginx -t
重新加载
/usr/local/nginx/sbin/nginx -s reload

发表评论