Article 6H6DQ Slackware - Httpd - Lets Encrypt - Multiple Domains

Slackware - Httpd - Lets Encrypt - Multiple Domains

by
pr0xibus
from LinuxQuestions.org on (#6H6DQ)
Morning Folks.

I had initially set this up with a single domain and it worked perfectly, but when adding a second domain I have issues.
I have managed to get the ssl cert from lets encrypt for both domains, when i visit domain1 its perfect, 80 and 443, when I visit domain2 it defaults to 80 and when i visit domain2:443 it redirects me to domain1. I have very little knowledge in httpd, below is my Vhost. Cleared browser cache on 2 different devices, but still the same issue, can anyone seem to spot issues below?

Code:#########################################################################
# VHost for NON HTTPS, port 80 only, has a permanent redirect to https #
#########################################################################
<VirtualHost *:80>
ServerName domain1.co.uk
ServerAlias www.domain1.co.uk
ServerAdmin myemail
DocumentRoot /srv/httpd/domain1.co.uk

Alias /.well-known/acme-challenge /usr/local/dehydrated
<Directory /usr/local/dehydrated>
Options None
AllowOverride None
Require all granted
</Directory>

#Redirect permanent "/" "https://www.domain1.co.uk"
</VirtualHost>

<VirtualHost *:80>
ServerName domain2.co.uk
ServerAlias www.domain2.co.uk
DocumentRoot /srv/httpd/domain2.co.uk/

Alias /.well-known/acme-challenge /usr/local/dehydrated
<Directory /usr/local/dehydrated>
Options None
AllowOverride None
Require all granted
</Directory>

#Redirect permanent "/" "https://www.domain2.co.uk"
</VirtualHost>

#########################################################################
# VHost for HTTPS, Port 443 domain1.co.uk #
#########################################################################
<VirtualHost *:443>
DocumentRoot "/srv/httpd/domain1.co.uk/"
ServerName www.domain1.co.uk
ServerAdmin myemail

<FilesMatch "\.(html|php)$">
SSLOptions
</FilesMatch>

Alias /.well-known/acme-challenge /usr/local/dehydrated
<Directory /usr/local/dehydrated>
Options None
AllowOverride None
Require all granted
</Directory>

SSLEngine on
SSLCertificateFile /etc/dehydrated/certs/www.domain1.co.uk/cert.pem
SSLCertificateKeyFile /etc/dehydrated/certs/www.domain1.co.uk/privkey.pem
SSLCertificateChainFile /etc/dehydrated/certs/www.domain1
SSLCACertificateFile /etc/ssl/certs/ca-certificates.crt

</VirtualHost>

#########################################################################
# VHost for HTTPS, Port 443 domain2.co.uk #
#########################################################################
<VirtualHost *:443>
DocumentRoot "/srv/httpd/domain2.co.uk/"
ServerName www.domain2.co.uk
ServerAdmin myemail

<FilesMatch "\.(html|php)$">
SSLOptions
</FilesMatch>

Alias /.well-known/acme-challenge /usr/local/dehydrated
<Directory /usr/local/dehydrated>
Options None
AllowOverride None
Require all granted
</Directory>

SSLEngine on
SSLCertificateFile /etc/dehydrated/certs/www.domain2.co.uk/cert.pem
SSLCertificateKeyFile /etc/dehydrated/certs/www.domain2.co.uk/privkey.pem
SSLCertificateChainFile /etc/dehydrated/certs/www.domain2.co.uk/chain.pem
SSLCACertificatePath /etc/ssl/certs
SSLCACertificateFile /etc/ssl/certs/ca-certificates.crt

</VirtualHost>
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments