Nginx catch-all config for http:// and https://
Catch-all for Port 80 (http://)
server {
listen 80 default_server;
server_name _;
return 404;
}
Catch-all for Port 443 (https://)
First generate a self signed cert:
openssl req -nodes -x509 -newkey rsa:4096 -keyout self_key.pem -out self_cert.pem -days 3650
server {
listen 443 default_server ssl;
ssl_certificate /path-to/self_cert.pem;
ssl_certificate_key /path-/self_key.pem;
return 404;
}