How to install nginx in centos !

Hitori Tech
  1. What is Nginx ?
  2. Now we gonna learn how to install nginx in centOS

What is Nginx ?


NGINX is a popular web server software that is widely used to serve web pages and other content over the internet. It is known for its high performance, stability, and low resource usage.

CentOS is a Linux distribution that is based on Red Hat Enterprise Linux (RHEL). It is designed for use in enterprise environments and is known for its stability and long-term support.

NGINX and CentOS are both widely used in production environments and are compatible with each other. The specific version of NGINX that is compatible with a given version of CentOS will depend on the version of CentOS and the features and dependencies required by your application.

Now we gone learn how to install nginx in centos

To install Nginx on a CentOS system, you can use the package manager yum. First, add the Nginx repository to your system by creating a file called /etc/yum.repos.d/nginx.repo with the following contents:

name=nginx repo

Then, run the following commands:

sudo yum update
sudo yum install nginx

Once the installation is complete, you can start the Nginx service with the command:

sudo service nginx start

You can also check the status of the service with this command:

sudo service nginx status

You can also configure Nginx to start automatically when the system boots by running the following command:

sudo chkconfig nginx on

You should also configure firewall to allow incoming traffic on port 80(http) and 443(https)

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

You can check the version of CentOS by running the following command in a terminal:

cat /etc/centos-release

This command will display the version number of the currently installed CentOS release, such as “CentOS Linux release 8.3.2011 (Core)

You can also use the following command to check the version and other information about your system:

lsb_release -a

Another way to check the version of CentOS is by using the uname command with the -r option, which shows the kernel version.

uname -r

If you are using GUI, you can also check the version of CentOS by going to settings and then about system, you will see the version of the CentOS.

Leave a Comment