I have a couple of web sites running on localhost with Apache/Ubuntu.
I just successfully installed self-signed certificates for one of these, call it securesite.local
. Another non-ssl site, call it insecuresite.local
also works as expected.
That is, if I navigate to
https://securesite.local
http://insecuresite.local
Each of these serves the correct content.
However, if I navigate to http://securesite.local
it serves content from insecure.local
My /etc/hosts contains
127.0.1.1 securesite.local
127.0.1.1 insecuresite.local
/etc/apache2/apache2.conf contains
IncludeOptional sites-enabled/*.conf
It does not contain any explicit references to securesite or insecuresite.
ls /etc/apache2/sites-enabled
securesite.conf insecuresite.conf
insecuresite.conf contains (abbreviated here)
<VirtualHost insecuresite.local:80>
ServerName insecuresite.local
ServerAlias insecuresite.local
# ...
securesite.conf contains (abbreviated here)
<VirtualHost securesite.local:443>
ServerName securesite.local
ServerAlias securesite.local
# ...
I want Apache to refuse connections to securesite.local over any port other than 443, not to fall back to serving content from any other site which does allow traffic on that localhost:80.
Why is this happening and how can I stop it?