How to Install Nginx on Direct Admin Control Panel easy setup guide:
Nginx Vs Litespeed Web Server
Nginx Web Server
Nginx is open-source software that runs in Linux Servers as Web Servers, Reverse Proxy Servers, Load Balancer, Media Caching etc. Nginx is majorly used as Web Server and it replaces Apache in many cases.
Nginx consumes very less Memory, CPU and Network Bandwidth in the server. Nginx works in the asynchronous model. Nginx runs on one Master Process instead of creating multiple threads for each request. Nginx serves 100x to 1000x requests per server which are more faster than Apache.
I have already explained in our previous article Nginx Vs Apache which is better for cPanel Hosting?
Litespeed Web Server
Litespeed is a lightweight web server that is developed and owned by the company Litespeed Technologies. Litespeed webserver again replaces Apache webserver. But Litespeed is highly compatible with all Apache Modules like mod_security, mod_rewrite etc. Litespeed web server has three releases.
- Open Source
Opensource Litespeed webserver runs in plain Linux Servers and doesn’t have GUI interface. This is used in small and non-commercial web servers.
- Standard Edition
This edition is licensed version which runs in Medium Web servers with less traffic. This edition can be installed along with control panels like WHM/cPanel or Direct Admin servers. This edition gets integrated with the control panels and can be managed within the control panel with GUI interface
- Enterprise edition
This edition is similar to Standard Edition, which can be installed and integrated with WHM/cPanel and Direct Admin Web Servers. This editions is developed to run in large web servers with high traffic
Litespeed web server is majorly used in Web Servers with Media Streaming. It handles concurrent connections with less memory and CPU usage. Apart from Web Server, Litespeed is also used as Load Balancer, Cache Accelerator etc. Litespeed handles sudden spikes in traffic as well as DDOS attacks.
How to Install nginx in Direct Admin Server
Nginx can be installed in a DA server via CustomBuild 2.0
If CustomBuild version is lesser than 2.0, upgrade CustomBuild as below
Login to Direct Admin control panel as Admin. Navigate to Extra Features > CustomBuild. Click the Upgrade button available on left-right side of the control panel.
Now ssh the server and navigate to /usr/local/directadmin/custombuild
Run below command to set the options.conf to use Nginx and php-fpm
# ./build set webserver nginx
Changed webserver option from apache to nginx
# ./build set php1_mode php-fpm Changed php1_mode option from mod_php to php-fpm #./build update # ./build all d # ./build rewrite_confs
After install Nginx check the Nginx status with below command
# lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nginx 3246 root 12u IPv4 631306 0t0 TCP server.rajesh.com:http (LISTEN) nginx 3246 root 13u IPv4 631307 0t0 TCP localhost:http (LISTEN) nginx 3247 nginx 12u IPv4 631306 0t0 TCP server.rajesh.com:http (LISTEN) nginx 3247 nginx 13u IPv4 631307 0t0 TCP localhost:http (LISTEN)
Litespeed installation on DirectAdmin Server
Before Litespeed installation (install nginx), visit the Litespeed store and obtain a License. The free license is available for a Server with Single Domain with less than 2G of RAM.
# bash <( curl https://get.litespeed.sh ) your_serial_no
After Litespeed installation, cross-check LiteSpeed web server is up and running as below
# lsof -i :80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME litespeed 12713 root 11u IPv4 987842 0t0 TCP *:http (LISTEN) litespeed 12713 root 14u IPv6 987843 0t0 TCP *:http (LISTEN) litespeed 12716 apache 11u IPv4 987842 0t0 TCP *:http (LISTEN) litespeed 12716 apache 14u IPv6 987843 0t0 TCP *:http (LISTEN)
Login to DA as admin and navigate to Services in Dashboard. Check for LiteSpeed is running as service.
Add Server Level Caching
Edit the file /etc/httpd/conf/extra/httpd-includes.conf and add the below entries
<IfModule Litespeed> CacheRoot /home/lscache/ </IfModule>
Add Virtual Host Caching
Create a file /usr/local/directadmin/data/templates/custom/cust_httpd.CUSTOM.2.pre Add below entries to the file
<IfModule Litespeed> CacheRoot lscache </IfModule>
Execute below command to enable mod_security with the Litespeed webserver
# cd /usr/local/directadmin/custombuild # ./build set modsecurity yes # ./build set modsecurity_ruleset comodo # ./build modsecurity
To apply the changes, execute below commands
# cd /usr/local/directadmin/custombuild # ./build rewrite_confs
Lightspeed web server remains an alternative of all webservers like Nginx or Apache due to below reasons.
- Litespeed is highly compatible with all Apache modules and provides high performance than other web servers.
- Litespeed can manage 1000s of visitors per second
- Litespeed requires minimal hardware resources. Litespeed consumes less Memory and CPU.
- Litespeed is highly secure with mod_security. It prevents servers from DDOS attacks.
- Litespeed offers zero downtime of websites
- Large E-Commerce and Video streaming servers use Litespeed web server for greater performance.