server { listen [::]:443 default_server ssl; listen 443 default_server ssl; listen [::]:80 default_server; listen 80 default_server; server_name _; access_log /var/log/nginx/default.access.log; error_log /var/log/nginx/default.error.log; # Generate a self-signed cert and key: "sudo openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt" ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt; ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key; # Generate a strong DH Param (can take 10 mins): "sudo openssl dhparam -out /etc/ssl/dhparam.pem 4096" ssl_dhparam /etc/ssl/dhparam.pem; ssl_protocols TLSv1.3 TLSv1.2 TLSv1.1; ssl_prefer_server_ciphers on; ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS; ssl_session_cache shared:TLS:2m; # Everything is a 404 location / { return 404; } }