Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache loads mod_ssl but <IfModule mod_ssl.c> ignored in my vhosts

I'm trying to secure my server's vhosts. I installed LE/Certbot fine, and had no issues. I installed/upgraded any dependencies to get certbot to work, again they ran fine.

mod_ssl is installed and loaded. I ran phpinfo(), and in the LoadedModules section, I see mod_ssl.

However, in my vhosts file, when I use

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ... 
    </VirtualHost>
</IfModule>

That specific site <VirtualHost></VirtualHost> block is ignored (i.e. I can't access site defined in VirtualHost block) UNLESS I remove/comment out the ` wrapper.

httpd version:

$ httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Apr 12 2017 21:03:28

I can't find much online, so I'm a little stuck. I'm worried there's something more sinister that's going to catch me out if I don't figure out why.

Any help would be much appreciated!

Cheers

like image 932
Kingsley Avatar asked Oct 18 '17 21:10

Kingsley


1 Answers

In case anyone else runs into this issue, it's because I was loading the vhosts configuration files before the mod_ssl extension.

I moved the Include vhost call to below the Include conf.d/*.conf call, in httpd.conf and restarted Apache and it worked.

Hope that helps someone!

like image 65
Kingsley Avatar answered Oct 19 '22 17:10

Kingsley