I'm trying to install ssl on multiple virtual hosts and domains on same IP. I am using multiple .conf files for this.
Already have three working domains on this IP with SSL. But while trying to install ssl on one more domain with command:
certbot-auto --apache -d mydomain.com -d www.mydomain.com
get this error:
The selected vhost would conflict with other HTTPS VirtualHosts within Apache. Please select another vhost or add ServerNames to your configuration. VirtualHost not able to be selected.
Here is the configuration I have in mydomain.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/mydomain/
ServerName mydomain.com
ServerAlias www.mydomain.com
<Directory /var/www/mydomain/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]