server { server_name ~^www\.(.*)$; return 301 $scheme://$1$request_uri; } server { listen 80; server_name ###domain### www.###domain###; error_log /var/log/nginx/###domain###-error.log warn; access_log /var/log/nginx/###domain###.log; location / { ###redirect_enable### return 301 https://$host$request_uri; root /var/www/html/; index index.html index.htm index.nginx-debian.html; } location /.well-known/acme-challenge/ { root /var/www/html/; default_type text/plain; } }