Answer the question
In order to leave comments, you need to log in
How to configure default vhost for https in apache?
I have a bunch of domain names configured on the same server, the first host loaded from /etc/apache2/sites-enabled is used by apache by default. Now if I request a non-existent subdomain for example a.domain2.com, then apache will direct me to default.com and so on for all other domains. I want to disable this and always show a 404 error if no matching vhost exists for the subdomain. For http traffic, I solved this problem by adding the following configuration:
<VirtualHost _default_:80>
Redirect 404 /
ErrorDocument 404 "Page Not Found"
</VirtualHost>
<VirtualHost _default_:443>
Redirect 404 /
ErrorDocument 404 "Page Not Found"
</VirtualHost>
Answer the question
In order to leave comments, you need to log in
In VirtualHost _default_:443, you need to add a description of the SSL configuration (certificate and key, at least, still bundle). Well, enable ssl there in principle (SSLEngine on).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question