在nginx.conf里面 include /etc/nginx/conf.d/*.conf; 在应该server里增加: if ($http_host !~ "^xxx.com") { rewrite /.* http://xxx.com$uri permanent; } 注意:!~ "^xxx.com" 这个xxx是你的域名,不用在前面带www.的 Last modification:July 24, 2017 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 送杯咖啡,做个交流,谢谢!
Comment here is closed