Httpd – After Setting Up SSL for one vhost https://sitename.com shows Apache 2 Test Page

httpdmod-sslssl-certificate

Thank you in advance for your support! We have been working on this for a couple days, lots of research and no luck with a solution.

Our web server is running on centos6 with apache (httpd-2.2.15-53) and mod_ssl using vhosts in the /etc/httpd/conf.d/vhosts/*.conf directory.

After setting up the ssl certs, and editing /etc/httpd/conf.d/ssl.conf, and /etc/httpd/conf.d/vhosts/example.conf (see below), now when we access the site via https://example.com we get the default Apache 2 Test Page. If we remove the /etc/httpd/conf.d/welcome.conf file and restart httpd we see the contents of the /var/www/html directory, which is the DocumentRoot in the /etc/httpd/conf/httpd.conf file.

Whats did we miss in our setup that is causing https://example.com to redirect to the default Apache 2 Test Page?

Here is the vhost file:

<VirtualHost *:80>
ServerAdmin myname@example.com
DocumentRoot /home/www/example
ServerName example.com
ServerAlias example.com www.example.com
DirectoryIndex index.php
ErrorLog logs/example.com-error_log
CustomLog logs/example.com-access_log common
CustomLog logs/example.com-access_log_urchin.log urchin
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/htm
SSLCertificateFile /usr/local/ssl/crt/public.crt
SSLCertificateKeyFile /usr/local/ssl/private/private.key
SSLCertificateChainFile /usr/local/ssl/crt/intermediate.crt
#DeflateFilterNote Input input_info
#DeflateFilterNote Output output_info
#DeflateFilterNote Ratio ratio_info
#LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
#CustomLog /var/log/httpd/example.deflate_log deflate
<Directory "/home/www/example/">
    AllowOverRide All
RewriteEngine On
</Directory>

# grep -ir 443 /etc/httpd/conf*

/etc/httpd/conf.d/ssl.conf:Listen 443
/etc/httpd/conf.d/ssl.conf:
/etc/httpd/conf.d/ssl.conf:#ServerName www.example.com:443

ss -antp | grep 443

LISTEN 0 128 :::443 :::* users:(("httpd",7097,6),("httpd",7441,6),("httpd",7466,6),("httpd",7549,6),("httpd",7551,6),("httpd",7552,6),("httpd",7557,6),("httpd",7559,6),("httpd",7560,6),("httpd",7562,6),("httpd",7564,6),("httpd",7614,6),("httpd",7616,6),("httpd",7619,6),("httpd",7621,6),("httpd",7622,6),("httpd",7625,6),("httpd",7667,6),("httpd",7669,6),("httpd",7670,6),("httpd",7671,6))
SYN-RECV 0 0 ::ac05:500:ffff:0:443 839::458f:6690:100:0:16413
ESTAB 0 122640 ::ffff:192.169.171.221:443 ::ffff:151.237.178.247:33969 users:(("httpd",7559,24))
TIME-WAIT 0 0 ::ffff:192.169.171.221:443 ::ffff:88.249.32.219:17220
TIME-WAIT 0 0 ::ffff:192.169.171.221:443 ::ffff:88.249.32.219:17979
TIME-WAIT 0 0 ::ffff:192.169.171.221:443 ::ffff:203.146.150.142:39904

apachectl -S

VirtualHost configuration:
wildcard NameVirtualHosts and default servers:
default:443 example.com (/etc/httpd/conf.d/ssl.conf:74)
*:80 is a NameVirtualHost
default server localhost (/etc/httpd/conf.d/vhosts/000default.conf:1)
port 80 namevhost localhost (/etc/httpd/conf.d/vhosts/000default.conf:1)
port 80 namevhost example1.com (/etc/httpd/conf.d/vhosts/example1.conf:1)
alias example1.com
alias www.example1.com
port 80 namevhost example.com (/etc/httpd/conf.d/vhosts/mokum.conf:1)
alias example.com
alias www.example.com

Thank you!

Best Answer

That's the config file for Apache listening on port 80. However, HTTPS is delivered via port 443. It's likely that you have a rogue site remapping port 443 to the default directory (Possibly even Apache's own /etc/apache2/sites-available/default-ssl.conf).

Related Topic