Installing Nginx on DirectAdmin

Updated on November 21, 2023
Installing Nginx on DirectAdmin header image

By default, DirectAdmin is deployed with the Apache web server. Converting this (including current websites) to Nginx can be done using its CustomBuild tool. After completing this guide, you will have a DirectAdmin server featuring an Nginx reverse proxy as its web server.

Using a reverse proxy comes down to running two web servers, one of which will be front-facing (Nginx), whilst the other is exclusively used for the back-end (Apache). This setup is very popular: because of Nginx's sublime performance, it has to save on the feature set. Apache has a very large feature set (among the most important features is the .htaccess file), but isn't able to beat Nginx's performance in terms of speed. Using a reverse proxy, you will for example be able to use the .htaccess in combination with the Nginx web server.

Step 1: Updating CustomBuild

Please confirm you are using CustomBuild 2.0. If you're not sure about this, please follow our guide on how to upgrade CustomBuild and/or check its current version.

Step 2: Modifying CustomBuild

Before we can recompile our DirectAdmin installation for it to work with Nginx and Apache, navigate to the CustomBuild directory:

cd /usr/local/directadmin/custombuild

Open the configuration file:

vi options.conf

Step 3: Modifying the PHP versions

DirectAdmin supports using multiple PHP versions alongside each other. If you want this, please follow our guide.

Currently, using an Nginx and Apache reverse proxy with DirectAdmin requires php-fpm to be used. If this is currently not the case, alter php1_mode and php2_mode in the CustomBuild options.conf file to the value php_fpm.

Step 4: Installing Nginx

After saving this file, install Nginx:

cd /usr/local/directadmin/custombuild
./build set webserver nginx_apache

This will not remove Apache.

Step 5: Deploying the reverse proxy

After compiling and building the web server, we will need CustomBuild to rewrite all configurations on the server:

./build update
./build nginx_apache
./build rewrite_confs

Nginx will now be installed. Depending on the size of your VULTR cloud server, this will take about 30 minutes. Please be patient and don't interrupt the installation or it will most likely fail and break the server.

Thank you for reading our tutorial, we wish you best of luck with your reverse proxy. Optionally, you can check if the installation succeeded with an online web server checker.