[apache] 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?

This question is related to apache ssl httpd.conf webmin virtualmin

The answer is


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.


I used:

sudo yum install mod24_ssl

and it worked in my Amazon Linux AMI.


Try installing mod_ssl using following command:

yum install mod_ssl

and then reload and restart your Apache server using following commands:

systemctl reload httpd.service
systemctl restart httpd.service

This should work for most of the cases.


Examples related to apache

Enable PHP Apache2 Switch php versions on commandline ubuntu 16.04 Laravel: PDOException: could not find driver How to deploy a React App on Apache web server Apache POI error loading XSSFWorkbook class How to enable directory listing in apache web server Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details How to enable php7 module in apache? java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing while starting Apache server on my computer

Examples related to ssl

Requests (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.") Error in PyCharm requesting website A fatal error occurred while creating a TLS client credential. The internal error state is 10013 curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number How to install OpenSSL in windows 10? ssl.SSLError: tlsv1 alert protocol version Invalid self signed SSL cert - "Subject Alternative Name Missing" "SSL certificate verify failed" using pip to install packages ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) Powershell Invoke-WebRequest Fails with SSL/TLS Secure Channel "ssl module in Python is not available" when installing package with pip3

Examples related to httpd.conf

How to enable directory listing in apache web server Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details httpd-xampp.conf: How to allow access to an external IP besides localhost? how to configure apache server to talk to HTTPS backend server? Apache Proxy: No protocol handler was valid Forbidden You don't have permission to access / on this server How to automatically redirect HTTP to HTTPS on Apache servers? Configure Apache .conf for Alias Apache could not be started - ServerRoot must be a valid directory and Unable to find the specified module Lost httpd.conf file located apache

Examples related to webmin

How to install mod_ssl for Apache httpd?

Examples related to virtualmin

How to install mod_ssl for Apache httpd?