Explore our in-depth
crafted by
skilled professionals!

Our Latest News, Advice and Thoughts

How to Install Nginx on DirectAdmin

You are here:

Typically, DirectAdmin makes use of the Apache webserver to serve web sites. At current, Apache dominates because the greatest server for web sites. The explanations for Apache server’s reputation are effectively documented. Apache’s energy and the power to serve Perl and Python. Nevertheless, Apache servers have some downsides. Apache contains excessive reminiscence footprints. Nginx is an alternate highly effective open supply internet server that’s sooner and consumes much less RAM. Nginx doesn’t have the inherent skill to course of dynamic content material. To deal with PHP and different requests for dynamic content material, Nginx should pass the request to an exterior processor for execution and await the content material to be despatched again, which might then be relayed to the shopper.

The method of changing the Apache webserver to Nginx webserver will be achieved utilizing the CustomBuild device, which lets you set up, take away, and recompile applications from supply. On the end of this information, you’ll have a DirectAdmin server that includes Nginx as a reverse proxy because the webserver. One efficient technique utilized by directors is the reverse proxying technique. On this technique, Nginx serves as a static internet server entrance, whereas Apache processes the again finish, making the most of the benefits of each internet servers. Nginx acts as an internet site visitors proxy, serving all static contents, akin to CSS, JS, photos, and so forth, by default. This considerably reduces the CPU/RAM assets consumed by Apache. Apache serves the dynamic contents, like PHP, PERL, and so forth. As a way to set up Nginx, CustomBuild 2.Zero have to be put in.


Set up Steps

            For set up, you want entry to the server and full root privileges to be able to modify the server configurations.


1) Updating the CustomBuild   

Because the set up requires recompilation of the supply code, it is suggested to take a backup of the server information. Make sure that CustomBuild is of the present model 2.Zero. If not, replace it to CustomBuild 2.0.


2) Modifying CustomBuild

Earlier than recompiling the DirectAdmin set up, the required configuration should be modified. To change the configurations, navigate to the CustomBuild listing and open the configuration file.

#cd /usr/native/directadmin/custombuild

#vi choices.conf

To make use of Nginx and Apache as a reverse proxy with DirectAdmin, php-fpm should be used. If that is not already the case, modify php1_mode and php2_mode within the CustomBuild options.conf file to the value php_fpm. Save the file with the changes.


3) Nginx set up

Now, you may set up the Nginx webserver. Observe that Apache won’t be removed during the installation of Nginx. The following commands will install the Nginx webserver on the server.

#cd /usr/native/directadmin/custombuild

#./build set webserver nginx_apache


4) Configuring the Reverse proxy

Both Nginx and Apache cannot work on port 80. Nginx will be on port 80, while Apache will be on another port. Nginx will transfer the dynamic page requests to Apache on this specified port. After compiling and building the Nginx webserver, we need to rewrite all configurations on the server to deploy the reverse proxy. Execute the following commands to rewrite the configurations.

#./build update

#./build all d

#./build rewrite_confs

Nginx will now be installed and running as the front-end internet server, preceding Apache. You can verify this using an online internet server checker. The configuration typically takes about half an hour, depending on the server.

Leave a Comment