Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. Nginx web server is more resource-friendly than Apache in most cases and can be used as a web server or a reverse proxy.
Install Nginx web server
Nginx is available in Ubuntu’s default repositories, so the installation is rather straight forward, but on CentOS we should add Nginx Repository.
sudo yum update
sudo yum install epel-release
sudo yum install nginx
or we can install directly from EPEL
yum --enablerepo=epel -y install nginx
Configure Basic Settings.
vi /etc/nginx/nginx.conf
change hostname
server_name www.yourdomaine.com;
Start Nginx
systemctl start nginx
Enable the service to start up at boot
systemctl enable nginx
If Firewalld is running, allow HTTP service. HTTP uses 80/TCP.
firewall-cmd --add-service=http --permanent
firewall-cmd --reload