server { server_name HOSTNAME; error_log /var/log/nginx/error.log; listen 443 ssl http2; location / { proxy_pass http://127.0.0.1:12081; proxy_set_header Host $host; } } server { listen 80; listen [::]:80; server_name HOSTNAME; # change hostname location / { return 301 https://$host$request_uri; } }