Can´t install SSL certificate - Certbot/Let's encrypt says vhost would conflic with other https virtualhosts

Hi there,

I would be very grateful for any help.

I was hosting a first website using Apache virtual host.

Today I added a second virtual host file (domain2.com.conf). I have also enabled this second website.

But, when trying to install a Let's Encrypt certificate through Cerbot it says that it was "unable to find a vhost with a ServerName or Address of domain2.com".

It also prompts me to a choice, but when I do that it returns the below error:

The selected vhost would conflict with other HTTPS VirtualHosts within Apache. Please select another vhost or add ServerNames to your configuration.

But I really don't understood the above, since I think this second vhost is correct, as below:

ServerName www.domain.com
        ServerAlias www.domain.com

        Protocols h2 http/1.1

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/domain.com/public_html

         <Directory /var/www/html/domain.com/public_html>
         Options -Indexes +FollowSymLinks
         AllowOverride All
         Require all granted
         </Directory>   

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog /var/www/html/domain.com/logs/error.log
        CustomLog /var/www/html/domain.com/logs/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf

Any idea about what could cause this issue, please?

Thanks in advance.

2 Replies

See:

https://stackoverflow.com/questions/57262394/installing-ssl-on-subdomain-error-vhost-would-conflict-with-other-https-virtual

This talks about subdomains but you should be able to extrapolate the information to top-level domains.

— sw

Great! Thank you so much!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct