To install Nginx on CentOS 7 or RHEL 7, you can use the following steps:
- Add the Nginx repository to your system:
sudo nano /etc/yum.repos.d/nginx.repo
- 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
- Install Nginx using the yum command:
sudo yum install nginx
- Start Nginx service:
sudo systemctl start nginx
- Verify that Nginx is running:
sudo systemctl status nginx
- Enable Nginx to start at boot:
sudo systemctl enable nginx
- 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.