Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install mod_ssl for Apache httpd?

Ok

So I installed Apache httpd a while ago and have recently come back to it to try setup SSL and get it serving several different tomcat servers.

At the moment I have two completely separate Tomcat instances serving up to slightly different versions (one for dev and one for demo say) my web app to two different ports:

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

I've successfully (back in Jan) used mod_jk to get httpd to serve those same Tomcat instances to http://www.example.com:8090/dev and http://www.example.com:8090/demo (8090 cos I've got another app running on 8080 via 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've 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 with apachectl restart (yes after shutting down that other app I mentioned so it doesn't toy with https connections) I continuously get the error:

Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration. httpd not running, trying to start

I've looked in the httpd/modules dir and indeed there is no mod_ssl, only mod_jk.so and httpd.exp.

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

Can anyone tell me how to install mod_ssl properly for my installed location of httpd so I can get past this error?

like image 528
Nick Foote Avatar asked Mar 10 '11 09:03

Nick Foote


People also ask

What is mod_ssl Apache?

mod_ssl is an optional module for the Apache HTTP Server. It provides strong cryptography for the Apache v1. 3 and v2 webserver via the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) cryptographic protocols by the help of the Open Source SSL/TLS toolkit OpenSSL.

In which directory is the mod_ssl configuration file located?

SSL Configuration (HTTPS) The installation of the mod_ssl package creates the "/etc/httpd/conf. d/ssl. conf" configuration file, which includes references to the default self-signed localhost certificate and key.


1 Answers

I found I needed to enable the SSL module in Apache (obviously prefix commands with sudo if you are not running as root):

a2enmod ssl 

then restart Apache:

/etc/init.d/apache2 restart 

More details of SSL in Apache for Ubuntu / Debian here.

like image 143
SharpC Avatar answered Oct 04 '22 21:10

SharpC