Install fast HTTP Server “Nginx” and configure HTTP Server with it.
[1] Install Nginx.
Install the prerequisites:
[root@www ~]# yum install yum-utils -y
To set up the yum repository, create the file named with the following contents: /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
By default, the repository for stable nginx packages is used. If you would like to use mainline nginx packages, run the following command:
[root@www ~]# yum-config-manager --enable nginx-mainline
To install nginx, run the following command:
[root@www ~]# yum install nginx
[2] Configure Basic Settings.
[root@www ~]# vi /etc/nginx/nginx.conf
# line 38: change hostname
server_name www.srv.world;
[root@www ~]# systemctl start nginx
[root@www ~]# systemctl enable nginx
[3] If Firewalld is running, allow HTTP service. HTTP uses 80/TCP.
[root@www ~]# firewall-cmd --add-service=http --permanent
success
[root@www ~]# firewall-cmd --reload
success
[4] Access to the default page of Nginx from a Client with Web browser and it’s OK if the following page are shown.