用rewrite把旧域名直接跳转到新域名的nginx配置
把下面代码保存到daziran.com.conf 放在nginx配置目录下 /etc/nginx/conf.d/
#把旧域名zdz8207直接跳转到新域名daziran.com的nginx配置server { listen 80; 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 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { }}
测试配置是否正确
# nginx -t重启nginxservice nginx restart查看nginx编译进去的模块命令:nginx -V------------------------------
本人微信公众帐号: 心禅道(xinchandao)
本人微信公众帐号:双色球预测合买(ssqyuce)