This article covers how to Install and configure Nginx on your CentOS 7 server. Now you can deploy your applications and use Nginx as a web or proxy server.
Nginx is a high performance web server software. It is a much more flexible and lightweight program than Apache HTTP Server.
To Install Nginx Web Server on CentOS 8:
1. Install the nginx package with:
$ sudo dnf install nginx
When prompted, enter y to confirm that you want to install nginx. After that, dnf will install Nginx and any required dependencies to your server.
2. After the installation is finished, run the following commands to enable and start the server:
$ sudo systemctl enable nginx
$ sudo systemctl start nginx
This will make Nginx start at system boot.
To configure Firewall Rules on CentOS for Nginx:
1. Run the following command to permanently enable HTTP connections on port 80:
$ sudo firewall-cmd --permanent --add-service=http
2. To verify that the http firewall service was added correctly, you can run:
$ sudo firewall-cmd --permanent --list-all
3. To apply the changes, you'll need to reload the firewall service:
$ sudo firewall-cmd --reload