Home WebServer PanelDirectAdmin How to install Nginx webserver on DirectAdmin

How to install Nginx webserver on DirectAdmin

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

In this article, AZDIGI will guide you to install Nginx webserver on DirectAdmin.

1. Overview of Nginx webserver

Nginx, stylized as NGINX or nginx or NginX, is a web server that can also be used as a reverse proxy, load balancer, mail proxy, and HTTP cache. The software was created by Igor Sysoev and released to the public in 2004.

With many comparison tests between Nginx and Apache (default webserver when installing DirectAdmin), Nginx has better performance in static websites. As for dynamic websites, both give the same performance.

However, nginx does not support .htaccess files, so if you use WordPress, you should skip this article and refer to the following article, both using Nginx and Apache to fix this problem and also help speed up static websites:

2. SSH into your DirectAdmin system

To install the Nginx webserver on DirectAdmin, we first need to SSH or access your VPS/server with root privileges. If you do not know how to SSH into your VPS/Server, you can refer to the following tutorial:

After successfully SSH, we continue with the next step to check the necessary conditions before installing the Nginx webserver on DirectAdmin.

2. System requirements before installing Nginx DirectAdmin webserver

To install Nginx webserver on DirectAdmin, your VPS/Server needs CustomBuild 2.0 version to install.

To check the version of CustomBuild you are using, please check out the following short tutorial:

In case your CustomBuild version is lower than 2.0 then you need to upgrade CustomBuild 1.x to 2.0 , you can check out the following tutorial:

After having CustomBuild 2.0, we continue with the following steps to install the Nginx webserver on DirectAdmin.

3. Install Nginx webserver on DirectAdmin

We use the following commands to install the Nginx webserver on DirectAdmin:

AZDIGI Tutorial
cd /usr/local/directadmin/custombuild
./build set webserver nginx
./build update
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build all d
./build rewrite_confs
    

Explanation of the above commands:

  • Command 1: Move to custombuild directory.
  • Command 2: Adjust the webserver configuration to nginx.
  • Command 3: Update custombuild script .
  • Command 4: Adjust the php1_mode configuration to php-fpm for good compatibility with nginx.
  • Command 5: Adjust the php2_mode configuration to php-fpm for good compatibility with nginx.
  • Command 5: Adjust the php3_mode configuration to php-fpm for good compatibility with nginx.
  • Command 7: Adjust the php4_mode configuration to php-fpm for good compatibility with nginx.
  • Command 8: Start reinstalling all services with DirectAdmin under the new configuration (This command runs for a relatively long time if your VPS/Server has a low configuration). With my VPS having 4 CPU cores, it takes about 40 minutes. This time may be longer if you use more than 1 PHP version.
  • Command 9: Rewrite your custom configuration, if you want everything to default, skip this command.

Below is an image of the order when executing the above commands and annotating each image:

Screen Shot 2020 07 30 at 2.44.22 PM
Command 1: Move to custombuild directory.
install Nginx webserver on DirectAdmin
Command 2: Adjust the webserver configuration to nginx.
Screen Shot 2020 07 30 at 2.55.48 PM
Command 3: Update custombuild script .
Screen Shot 2020 07 30 at 2.52.40 PM
Command 4, 5, 6, 7: Adjust the php1,2,3,4_mode configuration to php-fpm for good compatibility with nginx.
Screen Shot 2020 07 30 at 3.47.46 PM
Command 8: Start reinstalling all services with DirectAdmin under the new configuration (This command runs for a relatively long time if your VPS/Server has a low configuration). With my VPS having 4 CPU cores, it takes about 40 minutes. This time may be longer if you use more than 1 PHP version.
Screen Shot 2020 07 30 at 3.50.52 PM
Command 9: Rewrite your custom configuration, if you want everything to default, skip this command.

So we have completed the installation of the Nginx webserver on DirectAdmin. To see the version of Nginx you are using, use the nginx -v command. Here is my result.

Screen Shot 2020 07 30 at 3.52.52 PM
My newly installed Nginx version is 1.19.1.

4. Summary

Thus, AZDIGI has shown you how to install the Nginx webserver on DirectAdmin. Switching to an Nginx webserver will help your VPS/Server handle static websites better than Apache.

If you find the article useful, don’t forget to rate 5 stars.

Wishing you success.

If you need assistance, you can contact support in the ways below:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign