Nginx配置——域名跳轉

## 編輯配置文件linux

[root@aminglinux vhosts]# cd /usr/local/nginx/conf/vhosts/nginx

[root@aminglinux vhosts]# vim test.confvim

  server_name www.test.com www.aaa.com www.bbb.com;   ide

  if ( $host != 'www.test.com' ) {測試

       rewrite ^/(.*)$ http://www.test.com/$1 permanent;spa

}server

## 檢查語法並從新加載it

[root@aminglinux vhosts]# /usr/local/nginx/sbin/nginx -tclass

[root@aminglinux vhosts]# /usr/local/nginx/sbin/nginx -s reloadtest

## 測試

WEBRESOURCE1ec11fd8c746ccd6bec6556efdc0a

參考:

WEBRESOURCE05cf44f72dbbdb53fc3e92fac8d19

相關文章
相關標籤/搜索