Question

Apache ignoring documentroot with multiple SSL domains, not working

I am pulling my hair out here.

I have Apache running with two different domains running SSL using SNI.

The config is below. If I connect to console.somedomain.com it puts users in /var/www/html/ rather than /var/www/html/somedomain/Admin/adminv4/

However, If I connect to support1.somedomain.com , it works fine and are in the correct directory.

What one earth could be wrong here? The directory is valid.

<VirtualHost *:443>
DocumentRoot "/var/www/html/somedomain/Admin/adminv4/"
ServerName console.somedomain.com
SSLEngine On
SSLProtocol all -SSLv2
SSLCertificateFile /etc/httpd/ssl/console.somedomain.com/console.somedomain.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/console.somedomain.com/console.somedomain.com.key
<Directory "/var/www/html/somedomain/Admin/adminv4/">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
#
#
#NameVirtualHost support1.somedomain.com:443
<VirtualHost *:443>
DocumentRoot "/var/www/html/somedomain/"
ServerName support1.somedomain.com
SSLEngine on
SSLProtocol all -SSLv2
SSLCertificateFile /etc/httpd/ssl/support1_somedomain_com/support1.somedomain.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/support1_somedomain_com/support1.somedomain.com.key
SSLCertificateChainFile /etc/httpd/ssl/support1_somedomain_com/latest.ca-bundle
<Directory "/var/www/html/somedomain/">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Fixed it.

Turns out after this command:

apachectl -t -D DUMP_VHOSTS

*:443 is a NameVirtualHost default server console.somedomain.com (/etc/httpd/conf.d/ssl.conf:56) port 443 namevhost console.somedomain.com (/etc/httpd/conf.d/ssl.conf:56) port 443 namevhost console.somedomain.com (/etc/httpd/conf.d/ssl.conf:56) port 443 namevhost console.somedomain.com (/etc/httpd/conf/httpd.conf:441) port 443 namevhost console.somedomain.com (/etc/httpd/conf/httpd.conf:441) port 443 namevhost support1.somedomain.com (/etc/httpd/conf/httpd.conf:455) port 443 namevhost support1.somedomain.com (/etc/httpd/conf/httpd.conf:455)

Showed that console was reffered to in ssl.conf.

After looking, SSL.conf only had the default ssl.

I then remembered that my actual system hostname was console.somedomain.com

So, I removed the default ( i dont want anything else on SSL anyway. just vhosts i define. )

Restarted apache and now it works: apachectl -t -D DUMP_VHOSTS *:443 is a NameVirtualHost default server support1.somedomain.com (/etc/httpd/conf/httpd.conf:444) port 443 namevhost support1.somedomain.com (/etc/httpd/conf/httpd.conf:444) port 443 namevhost support1.somedomain.com (/etc/httpd/conf/httpd.conf:444) port 443 namevhost console.somedomain.com (/etc/httpd/conf/httpd.conf:458) port 443 namevhost console.somedomain.com (/etc/httpd/conf/httpd.conf:458)