How to install and use Nginx on CentOS 7 / RHEL 7

To install Nginx on CentOS 7 or RHEL 7, you can use the following steps:

  1. Add the Nginx repository to your system:
sudo nano /etc/yum.repos.d/nginx.repo
  1. Paste the following configuration in the file and save it:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
  1. Install Nginx using the yum command:
sudo yum install nginx
  1. Start Nginx service:
sudo systemctl start nginx
  1. Verify that Nginx is running:
sudo systemctl status nginx
  1. Enable Nginx to start at boot:
sudo systemctl enable nginx
  1. Access the Nginx default web page by opening a web browser and navigating to http://your-server-ip.

You should now be able to use Nginx as a web server on your CentOS 7 or RHEL 7 system.

Leave a Comment