需求:把 abc.com 301重定向到www.adc.com
環境:lnmp
做法:找到conf配置文件,頂部新增
server{ listen 80; server_name abc.com; return 301 http://www.abc.com$request_uri; }
原來那個server模塊里的server_name只留一個www.adc.com就可以
tip:
檢查Nginx環境配置命令
nginx -t
熱更新配置文件
nginx -s reload
關於熱更新詳細解讀:https://blog.csdn.net/woay2008/article/details/102770759
以上命令如不能用就是沒有配置環境變量