I have nginx with following vhosts:
A gitlab vhost:
server {
listen 443;
server_name gitlab.mydomain.com; # e.g., server_name source.example.com;
server_tokens off; # don't show the version number, a security best practice
root /home/git/gitlab/public;
ssl on;
ssl_certificate /etc/nginx/ssl/gitlab.crt;
ssl_certificate_key /etc/nginx/ssl/gitlab.key;
...
# individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
...
}
Default vhosts to catch all other domain names
server {
listen 80;
return 444;
}
server {
listen 443;
return 444;
}
But now if go to gitlab.mydomain.com, I get only
Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
Nothing else. And without default rules the gitlab.mydomain.com
is also accessible over every *.mydomain.com
. This is unacceptable.
How to configure nginx so, that it responds only to the configured names?