三个地方要注意:
一、116.XXX.XXX.206(外网服务器)上的nginx.conf上配置: server_name xxx.com www.xxx.com; 保存重启nginx
二、内网服务器上(192.168.0.83)xxx.com.conf文件上配置如下:
ServerName xxx.com
ServerAlias www.xxx.com *.xxx.com
DocumentRoot /pkg/web/www.xxx.com/webroot
ServerAdmin rd@prykweb.com
ErrorLog /pkg/log/error_log_xxx
CustomLog /pkg/log/access_log_xxx combined
保存重启apache
三、在网站源代码.htaccess文件里添加如下:
RewriteEngine On
RewriteCond %{http_host} ^xxx.com [NC]
RewriteRule ^(.*)$ http://www.xxx.com/$1 [R=301.L]