I have these domains
domain.com
www.domain.com
srv.domain.com
pointing to the same server IP, but want my website to be accessible only via domain.com
and www.domain.com
which have SSL certificates. I run a TCP-based service accessed via srv.domain.com
; there is no SSL certificate for it, but currently I can still access the website via this subdomain.
How should I configure Apache so that it blocks HTTPS (and HTTP) requests to this particular subdomain?
My configs look like this:
000-default.conf:
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/html
AllowEncodedSlashes NoDecode
RewriteEngine on
RewriteCond %{SERVER_NAME} =domain.com [OR]
RewriteCond %{SERVER_NAME} =www.domain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
000-default-le-ssl.conf:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/html
AllowEncodedSlashes NoDecode
Include /etc/letsencrypt/options-ssl-apache.conf
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
</VirtualHost>
</IfModule>