server {
listen 80;
server_name www.xxx.com xxx.com;
if ($host != 'www.xxx.com') {
rewrite ^/(.*)$ http://www.xxx.com/$1 permanent;
}
server {
listen 80;
server_name www.xxx.com xxx.com;
if ($host != 'www.xxx.com') {
rewrite ^/(.*)$ http://www.xxx.com/$1 permanent;
}