server { listen 80; server_name localhost; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name m.com.cn; #... }