DirectAdmin is a graphical web-based web hosting control panel designed to make administration of websites easier. DirectAdmin, By default, is deployed with the Apache web server. To change web server from Apache (including current websites) to Nginx can be done using Directadmin’s CustomBuild tool. This guide will help you install Nginx as a web server in Directadmin.
NGINX is a free, open-source, high-performance HTTP server and reverse proxy server which is very easy to configure. It has a very low resource consumption and uses an event-driven architecture to handle requests.
NGINX accelerates content and application delivery, improves security, facilitates availability and scalability for the busiest websites on the Internet.
NGINX is one of a handful of servers written to address the C10K problem. Click here to know more about C10K problem.
Ok, let’s start this tutorial on how to install Nginx as a web server in Directadmin.
Steps involved in Installing Nginx in Directadmin.
Upgrade Directadmin to CustomBuild 2.0.
First of all, If you are using Custombuild 1.x, upgrade Directadmin to CustomBuild 2.0. If you are already using CustomBuild 2.0 then you can skip this step.
Check which version you are using:
shell> cd /usr/local/directadmin/custombuild shell> ./build version
Upgrade to CustomBuild 2.0.
shell> cd /usr/local/directadmin shell> mv custombuild custombuild_1.x shell> wget -O custombuild.tar.gz http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz shell> tar xvzf custombuild.tar.gz shell> cd custombuild shell> ./build
Install Nginx web server with PHP-FPM in Directadmin.
Now that we have upgraded to CustomBuild 2.0, we can use these commands to switch web server from Apache to Nginx. we will also use PHP-FPM with Nginx.
shell> cd /usr/local/directadmin shell> ./build set webserver nginx
shell> /build set php1_mode php-fpm
shell> ./build update
shell> ./build all d
This whole process will take close to 20 minutes depending upon the size of RAM and Processing power of your VPS.
shell> ./build rewrite_confs
You may need restart Nginx in DirectAdmin with this command :
shell> /sbin/service nginx restart
All the Nginx Configuration files will be stored in /etc/nginx directory.
The additional Nginx configuration files related to your Domain can be found in:
shell> cd /usr/local/directadmin/data/users/username/ shell> ls -l | grep nginx -rw-r----- 1 diradmin username 1541 Nov 26 19:27 nginx.conf -rw-r--r-- 1 diradmin diradmin 407 Nov 26 16:34 nginx_php.conf