server {
listen 80;
server_name www.mysite.com mysite.com;
if ($host = 'mysite.com' ) {
rewrite ^/(.*)$ http://www.mysite.com/$1 permanent;
}
}
server {
listen 80;
server_name www.mysite.com mysite.com;
if ($host = 'mysite.com' ) {
rewrite ^/(.*)$ http://www.mysite.com/$1 permanent;
}
}
转载于:https://blog.51cto.com/xlogin/1051171