How to build NGINX against OpenSSL 3.0.0

The latest stable version of OpenSSL is the 3.0 series. Also available is the 1.1.1 series of OpenSSL which is a Long Term Support (LTS) version, supported as of 11 September 2023. We use the newer version 3.0.0 of the software to support TLSv1.3 in NGINX on CentOS. 7 and Debian servers that still run older versions of the library.

This guide only covers the installation of NGINX+OpenSSL 3.0.0 on a server with DirectAdmin. Other cases not mentioned here.

Dependency on CentOS/AlmaLinux/CloudLinux

To compile things we will need to install the following packages:

yum -y install perl-IPC-Cmd

Other packages may also be required. We will update the list as we find them.

Dependency on Debian/Ubuntu

To compile things we will need to install the following packages:

apt -y install libgd-dev

Other packages may also be required. We will update the list as we find them.

CustomBuild 2.0 and DirectAdmin

Now we need to make sure that there is no custom script to configure NGINX. It may exist if there is already another custom module added to NGINX.

cd /usr/local/directadmin/custombuild/
mkdir -p custom/nginx_reverse/
ls -la custom/nginx_reverse/
cat custom/nginx_reverse/configure.nginx

The latest command from the list should return empty (nothing). This is an expected output.

If we see a line from the file, stop here. copy file

cp -p custom/nginx_reverse/configure.nginx custom/nginx_reverse/configure.nginx~bak

Analyze its contents. and compare it /usr/local/directadmin/custombuild/configure/nginx_reverse/configure.nginx, This is the native, i.e. default, script. See which rows differ.

And we install a custom script to compile NGINX:

wget  -O custom/nginx_reverse/configure.nginx
chmod 755 custom/nginx_reverse/configure.nginx

Install custom configuration:

cd /usr/local/directadmin/custombuild/
mkdir -p custom/nginx_reverse/conf/
cp -p custom/nginx_reverse/conf/nginx-defaults.conf custom/nginx_reverse/conf/nginx-defaults.conf~bak
wget  -O custom/nginx_reverse/conf/nginx-defaults.conf

Then install NGINX:

cd /usr/local/directadmin/custombuild/
./build update
./build nginx
./build rewrite_confs

If an error occurs during installation, you will have to check it yourself, or contact us for support.

undo changes:

Copy the saved files to their original locations (if you had custom copies of them before following this guide):

/usr/local/directadmin/custombuild/
mv -f custom/nginx_reverse/configure.nginx~bak custom/nginx_reverse/configure.nginx
mv -f custom/nginx_reverse/conf/nginx-defaults.conf~bak custom/nginx_reverse/conf/nginx-defaults.conf

or extract custom files (if you used the default NGINX installation):

/usr/local/directadmin/custombuild/
rm -f custom/nginx_reverse/configure.nginx
rm -f custom/nginx_reverse/conf/nginx-defaults.conf

and reinstall nginx:

cd /usr/local/directadmin/custombuild/
./build update
./build nginx
./build rewrite_confs

That’s it.

Leave a Comment