Upgrading Openssl for Apache on Ubuntu


Created on: 11/21/19
Last update: 11/21/19

Just upgraded the OpenSSL from 1.0.2 to 1.1.1. on a server with Ubuntu 16.04.

Install OpenSSL

Install required packages

sudo apt-get install make

Download OpenSSL

cd /usr/local
wget https://www.openssl.org/source/openssl-1.1.1.tar.gz
tar -xvf openssl-1.1.1.tar.gz 


cd openssl-1.1.1
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl
make test
make install

Create and edit /etc/ld.so.conf.d/openssl-1.1.1.conf, add following path:


Reload the dynamic link:

sudo ldconfig -v

Configure OpenSSL Binary

Backup the current binary files:

mv /usr/bin/c_rehash /usr/bin/c_rehash.BEKUP
mv /usr/bin/openssl /usr/bin/openssl.BEKUP

Edit the /etc/environment file using vim.


Check the openssl version:

openssl version -v

Enable New OpenSSL on Apache

Navigate to the Apache source file (e.g., /usr/local/httpd-2.4.41/). Configure and update Apache:

make clean
./configure --prefix=/usr/local/apache24 --with-included-apr --enable-ssl --with-ssl=/usr/local/ssl  --enable-ssl-staticlib-deps --enable-mods-static=ssl
make install

The mod_ssl modeule (/usr/local/apache24/modules/mod_ssl.so) will be recompiled.

Check the HEAD of target url at https://apitester.com/. The response would be like:

HTTP/1.1 200 OK
Date: Thu, 21 Nov 2019 18:48:42 GMT
Server: Apache/2.4.41 (Unix) OpenSSL/1.1.1
Last-Modified: Mon, 11 Jun 2007 18:53:14 GMT
ETag: "2d-432a5e4a73a80"
Accept-Ranges: bytes
Content-Length: 45
Content-Type: text/html


How to Install the latest OpenSSL version from Source on Linux

Use Different OpenSSL for Apache

how to upgrade openssl for apache 2.2.29 - still using old 0.9.8 version