用rewrite把旧域名直接跳转到新域名的nginx配置

用rewrite把旧域名直接跳转到新域名的nginx配置

把下面代码保存到daziran.com.conf 放在nginx配置目录下 /etc/nginx/conf.d/

#把旧域名zdz8207直接跳转到新域名daziran.com的nginx配置
server {
listen ;
server_name zdz8207.com www.zdz8207.com;
access_log /var/log/nginx/access_zdz8207.com.log;
error_log /var/log/nginx/error_zdz8207.com.log; rewrite /.* http://daziran.com$uri permanent; error_page /.html;
location = /40x.html {
}
error_page /50x.html;
location = /50x.html {
}
}

测试配置是否正确
# nginx -t
重启nginx
service nginx restart
查看nginx编译进去的模块命令:
nginx -V

上一篇:CSAPP 六个重要的实验 lab5


下一篇:奇怪吸引子---TreeScrollUnifiedChaoticSystem