NGNIX Installation on a VPS

The NGINX(Pronounced “Engine X”) is a free, open-source HTTP web server and reverse proxy, as well as operates as an IMAP/POP3 mail proxy server and as a load balancer with HTTP cache server.

NGNIX installation on a Virtual Private Server (VPS)

Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet.

NGINX is known for its highly scalable,  performance, simple configuration, high stability, rich feature set,  resource-friendly, and low resource consumption. For these reasons, it is a great alternative to the more commonly used Apache webserver(third most popular Web server behind the Apache Server).

Today, we are going to discuss setting up and configuring NGNIX on a Virtual Private Server (VPS).

Prerequisites

  • A non-root user with Sudo privileges configured on your server.
  • SSH access to your VPS

How to install NGINX on VPS

1. Install NGINX

with the “yum” Package manager  using the following commands:

>>yum install epel-release>>yum install Nginx 

2. Start NGINX

After installation, start the NGINX:

>>Systemctl start Nginx 

3. Allow the Nginx

Check if HTTP and HTTPS ports are allowed by firewalls

>>firewall-cmd --list-all

Note: If TCP ports 80 and 443 are not listed, the allow them to the firewall using following commands

>>firewall-cmd --permanent --zone=public --add-port=80/tcp >>firewall-cmd --permanent --zone=public --add-port=443/tcp 

4. Reload the firewall

>>firewall-cmd --reload  

5. Test the NGINX

To test the installation you need to use your public IP address

  https://your_server_IP_address/

6. Configure the NGINX and Boot it

The main NGINX configuration file is located at

  >>/etc/Nginx/nginx.conf.>>systemctl enable Nginx

How to Restart Nginx

Test the Nginx configuration and restart Nginx:

>>sudo Nginx -t>>sudo systemctl restart Nginx

How to uninstall the Nginx

  1. If you want to keep config files and just want to remove the Nginx
>>sudo apt-get remove Nginx Nginx-common
  1. If you want completely uninstall the Nginx
>>sudo apt-get purge Nginx Nginx-common

That’s it! Now that you have your web server – NGINX installed successfully on a VPS!

Leave a Reply

Your email address will not be published.