Default site configured for 444 returns 404
Steinar Bang
sb at dod.no
Sun Aug 25 20:52:41 UTC 2024
Ok, found it!
Turned out one of my other configs (the server www.mycompany.com one)
had this
server {
# SSL configuration
#
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /etc/letsencrypt/live/www.mycompany.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.mycompany.com/privkey.pem;
server_name www.mycompany.com;
}
so what I did, was:
1. Remove the " default_server" from the www.mycompany.com server:
server {
# SSL configuration
#
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /etc/letsencrypt/live/www.mycompany.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.mycompany.com/privkey.pem;
server_name www.mycompany.com;
}
2. Add SSL listening for default_server to the default config:
server {
listen 80 default_server;
listen [::]:80 default_server;
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /etc/letsencrypt/live/www.bang.priv.no/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.bang.priv.no/privkey.pem;
server_name _;
return 444;
}
After this, all IP number accesses to my server on either port 80 or
port 443, are met with 444.
More information about the nginx
mailing list