Sunday, 24 November 2019

How to Install and Configure Nginx Server on CentOS 8




Nginx is a free and open source high-performance web server. It is also used for reverse proxy, load balancer and content cache servers. Now its binary is available in CentOS 8 AppStream Repository.

This article describes How to Install and Configure Nginx Server on CentOS 8.

Step 1. Nginx Packages Installation: Run the following commands to install Nginx binary package and its dependencies from CentOS 8 AppStream Repository:

[root@linuxcnf ~]# dnf install nginx –y
…………………….
Installed:
  nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                            gd-2.2.5-6.el8.x86_64
…………………….
  perl-threads-1:2.21-2.el8.x86_64                                               perl-threads-shared-1.58-2.el8.x86_64

Complete!
[root@linuxcnf ~]#

Step 2. Start Nginx Service: Run the following command to start Nginx service and enable for auto start on machine reboot:

[root@linuxcnf ~]# systemctl start nginx
[root@linuxcnf ~]# systemctl enable nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service /usr/lib/systemd/system/nginx.service.
[root@linuxcnf ~]#

Step 3. Firewall Configuration: Run the following command to allow access in firewall rules:

[root@linuxcnf ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp
success
[root@linuxcnf ~]# firewall-cmd --reload
success
[root@linuxcnf ~]#

Step 4. Verification: Now hit server IP address or host name from any web browser and the following Nginx default page will open:
















Done!!! Nginx Installation is done on CentOS 8.

No comments:

Post a Comment