How to set mod_ssl for Apache httpd?

OK

So, I installed Apache httpd some time ago and recently returned to it to try installing SSL and getting it to serve several different tomcat servers.

Currently, I have two completely separate Tomcat instances serving several different versions (one for dev and one for demo), my web application for two different ports:

  • example.com:8081
  • example.com:8082

I successfully (back in January) used mod_jk to get httpd to serve the same Tomcat instances up to http://www.example.com:8090/dev and http://www.example.com:8090/demo (8090 cos. I have another application running on 8080 through Jetty at this stage) using the following code in httpd.conf :

 LoadModule jk_module modules/mod_jk.so JkWorkersFile conf/workers.properties JkLogFile logs/mod_jk.log JkLogLevel debug <VirtualHost *:8090> JkMount /devd* tomcatDev JkMount /demo* tomcatDemo </VirtualHost> 

What I'm not trying to do is enable SSL.

I added the following to httpd.conf :

 Listen 443 <VirtualHost _default_:443> JkMount /dev* tomcatDev JkMount /demo* tomcatDemo SSLEngine on SSLCertificateFile "/opt/httpd/conf/localhost.crt" SSLCertificateKeyFile "/opt/httpd/conf/keystore.key" </VirtualHost> 

But when I try to restart Apache using apachectl restart (yes, after closing this other application that I mentioned, it does not play with https connections), I constantly get an error:

Invalid "SSLEngine" command, possibly with an error or determined by a module not included in the server configuration. httpd does not work, trying to start

I looked in the httpd/modules directory and there really is no mod_ssl , only mod_jk.so and httpd.exp .

I tried using yum to install mod_ssl , it says it is already installed. Indeed, I can find mod_ssl.so in /usr/lib/httpd/modules , but this is NOT the path to where I installed httpd , which is /opt/httpd , and actually /usr/lib/httpd contains nothing, except modules dir.

Can someone tell me how to set mod_ssl correctly for my installed httpd location so that I can get past this error?

+48
ssl apache
Mar 10 2018-11-11T00:
source share
3 answers

Are there any other LoadModule commands that reference modules in the /usr/lib/httpd/modules folder? If so, you should simply add LoadModule ssl_module /usr/lib/httpd/modules/mod_ssl.so to your conf file.

Otherwise, you need to copy the mod_ssl.so file to any directory from which other modules are loaded, and link to it there.

+26
Mar 10 2018-11-11T00:
source

I found that I need to enable the SSL module in Apache (obviously, prefix commands with sudo if you are not using root):

 a2enmod ssl 

then restart apache:

 /etc/init.d/apache2 restart 

Learn more about SSL in Apache for Ubuntu / Debian here .

+66
Jun 26 '13 at 12:00
source

Try setting mod_ssl using the following command:

 yum install mod_ssl 

and then reboot and restart the Apache server using the following commands:

 systemctl reload httpd.service systemctl restart httpd.service 

This should work in most cases.

+10
Oct 05 '16 at 12:20
source



All Articles