server { server_name congyu.org; server_name cn.congyu.org; root /var/www/html; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ =404; } listen [::]:443 ssl ipv6only=on; listen 443 ssl; ssl_certificate /etc/letsencrypt/live/congyu.org/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/congyu.org/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; } server { if ($host = congyu.org) { return 301 https://$host$request_uri; } listen 80; listen [::]:80; server_name congyu.org; return 404; } server { if ($host = cn.congyu.org) { return 301 https://$host$request_uri; } listen 80; listen [::]:80; server_name cn.congyu.org; return 404; }