1

I have an apache server configured as a virtual host (name-based), suppose that the ip is 186.54.251.57, if I enter that ip address the apache home page will be displayed...

if I enter example1.com with either http or https it works fine as it has an R3 certificate (letsencrypt)

example2.com also works fine and so on (as long as the domains are set to apache2)

The problem is when I add a domain to my DNS servers, then the A record points to the address 186.54.251.57 but the domain example3.com is not yet configured in apache, if I enter the browser and type http://example3. com will take me to the apache home page, but the problem comes when I enter through https://example3.com, as the domain does not yet have an ssl certificate because it is not configured in apache, so it loads the content of example2.com because it associates the ssl certificate of the other page and consequently shows its content...

How can I prevent that? What if you have A record in the dns that points to the ip address of the apache server but if you don't have an ssl certificate then don't load another foreign page?

1 Answers1

0

I will leave the solution since it is something simple, but for those who do not know it it can be uncomfortable...

It turns out that apache reads the configuration files in alphabetical order, that's why the apache home page starts with 000-default, however the default ssl page does not have "000" at the beginning, only "default-ssl" so when a domain with alphabetical order with the letter "a, b or c" is created, it will become the default ssl website...

so basically what i did was renamed the "default-ssl" config file to "000-default-ssl" and the problem was solved.