1

I have a VPS with ubuntu 16, apache and the following three domains:

domain1.com domain2.com

domain1 has SSL enabled. domain2 has no SSL. This is working fine. Now, I tried to create a new site using a subdomain of domain2:

portal.domain2.com

Whenever I try to open that site, the browser will show me a SSL error saying that my SSL certificate is not for that domain. But I don't want SSL on that domain/subdomain !

My domain2.com.conf is identical with my portal.domain2.com.conf file, except for the ServerName and ServerAlias.

What could I be doing wrong?

domain1 configuration:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/domain2.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    ServerName domain2.com
    ServerAlias www.domain2.com
</VirtualHost>

portal.domain1 configuration:

<VirtualHost *:80>
    ServerAdmin email@email.com
    ServerName portal.domain2.com
    DocumentRoot /var/www/portal.domain2.com/public_html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Edit 1: If I run apachectl -tD DUMP_VHOSTS:

VirtualHost configuration:
*:443                  domain1.com (/etc/apache2/sites-enabled/domain1.com-le-ssl.conf:2)
*:80                   is a NameVirtualHost
     default server 158.69.192.185 (/etc/apache2/sites-enabled/000-default.conf:1)
     port 80 namevhost 158.69.192.185 (/etc/apache2/sites-enabled/000-default.conf:1)
     port 80 namevhost domain2.com (/etc/apache2/sites-enabled/domain2.conf:1)
             alias www.domain2.com
     port 80 namevhost domain1.com (/etc/apache2/sites-enabled/domain1.com.conf:1)
             alias www.domain1.com
     port 80 namevhost portal.domain2.com (/etc/apache2/sites-enabled/portal.domain2.com.conf:1)
Perroloco
  • 111
  • 4

0 Answers0