How to change default virtual host ssl


#1

Hello,

i’ve tried to install on my debian 9 server with apache 2.0 certificate ssl with certbot and all works fine.
But now i’ve an issue…on my server there are different virtual host on port 80 for some domains, each domain has its own file .conf.
for 2 of this domains i’ve generated the certificate with certbot and two ssl files were generated for port 443

the problem is that for domains that do not have a configured ssl they are redirected to the default one, which is no longer the default-ssl.conf but the last certificate generated with certbot
even doing the apachectl command -S I see that the default for calls on port 443 has changed.
To temporany solve the problem, I copied the content of default-ssl.conf file to the new default file, so unrecognized domains are redirected to / var / www / html
Is there a way to force the default server modified by certbot?

thanks


#2

Hi,

Of course you can.

Please go to your list of ssl vHosts, find the one you desired to make default, then change the name of the Desired vHost, make it list as the first vHost in that folder.

(Since Apache treats the config files in a top-down approach. It will default to the first vhost based upon alpahbet (if no numbers are present), or the lowest number config file.)

Thank you


#3

OK i’m a stupid…i’ve tried to do that before, but i forgot to run a2ensite for 000-default-ssl.conf to create the sym link :slight_smile: now it works! thanks


#4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.