首页 > 系统服务 > 详细

Linux- Nginx域名重定向

时间:2018-11-27 16:34:24      阅读:193      评论:0      收藏:0      [点我收藏+]
更改test.com.conf
server
{
listen 80;
server_name test.comtest1.comtest2.com;
index index.html index.htm index.php;
root /data/wwwroot/test.com;
if ($host != ‘test.com‘ ) {
rewrite ^/(.*)$ http://test.com/$1 permanent; #如果访问的不是test.com,则跳转到这边,permanent代表301
}
}
? server_name后面支持写多个域名,这里要和httpd的做一个对比
? permanent为

Linux- Nginx域名重定向

原文:http://blog.51cto.com/13451715/2322350

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!