How To Install Nginx On CentOS 7
In this post, I will guide you on How To Install Nginx On CentOS 7. Nginx is an alternative to Apache and is a part of the LEMP stack.
About Nginx
Nginx (pronounced ‘engine X’) is a high-performance free web server software that can be used as a reverse proxy server responsible for handling the load of a large website. It is a much more flexible and lightweight program than Apache HTTP Server.
Prerequisites
- CentOS 7 server.
- The root or sudo privileges.
Installing Nginx
1. Update Repository Package Lists.
sudo yum update
2. Install Extra Packages for Enterprise Linux (EPEL).
sudo yum -y install epel-release
3. Install Nginx.
sudo yum -y install nginx
4. Start Nginx Service.
sudo systemctl start nginx
If you are running a firewall, run the following commands to allow HTTP and HTTPS traffic:
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=httpssudo firewall-cmd --reload
Checking your Nginx
Use your browser access by link:
http://your_server_ip
You should see the CentOS 7 Nginx web page.
Managing Nginx
To stop web server:
sudo systemctl stop nginx
To start Nginx:
sudo systemctl start nginx
Restart the web server:
sudo systemctl restart nginx
If you are simply making configuration changes, Nginx can often reload without dropping connections.
sudo systemctl reload nginx
By default, Nginx is configured to start automatically when the server boots. Disable this behavior by typing:
sudo systemctl disable nginx
This is the end of the How To Install Nginx On CentOS 7.
Follow us for the more helpful posts!
We hope this is a useful post for you How To Install Plesk On CentOS 7.
Thank you for reading!