Connect with us

Hi, what are you looking for?


How to Set Up NGINX Web Server on CentOS 8 / RHEL 8

In this tutorial we will Set Up NGINX Web Server on CentOS 8 / RHEL 8. NGINX is the high performance web server and reverse proxy server. The CentOS 8 and RHEL 8 is the first version of Red Hat family by default contains NGINX packages in default repository. The NGINX can be used as a Web Server it has very low foot printing. Which allows to be run NGINX under a production environment.

Step-1 : Check whether the NGINX packages is install by default or not

[root@techbrown~]# rpm -q nginx

Step-2 : Install the NGINX package using DNF package manager

[root@techbrown~]# dnf install nginx -y

Step-3 : As soon as installation completes start the services of NGINX

[root@techbrown~]# systemctl start nginx

Step-4 : Enable the services of NGINX so that it will survive during boot

[root@techbrown~]# systemctl enable nginx

It will show given output

ln -s '/usr/lib/systemd/system/nginx.service' '/etc/systemd/system/multi-'

Step-5 : Add the service http and https from the firewalld firewall for communicating with NGINX

[root@techbrown~]# firewall-cmd --permanent --add-service={http,https}

It will show given output


Step-6 : When done reload the firewall to activate the new rules

[root@techbrown~]# firewall-cmd --reload

It will show the given output

Advertisement. Scroll to continue reading.

Step-7 : Change Current Working Directory to the /usr/share/nginx/html

[root@techbrown~]# cd /usr/share/nginx/html/

Step-8 : Create a .html file

Create a .html file and enter the contents of web site. Here simple.html is our html file.

[root@techbrown html]# vim simple.html

Step-9 : Change Current Working Directory to /etc/nginx/conf.d/

[root@techbrown html]# cd /etc/nginx/conf.d/

Step-10 : Create a configuration file here

For ex. we create simple.conf, and put all the configuration detail of your server like, Server Name as well as  Allowed & Denied users. In this tutorial we only allowing access for It upon the users whom they want allow or deny. Select server name and configure the conf file same as below.

[root@techbrown conf.d]# vim simple.conf

You have to filled all the configuration detail as below. with there needs in this file and go to insert mode.

server {
        listen 80;
        listen [::]:80;

        root /usr/share/nginx/html;
        index index.html index.htm;


        location / {
                try_files $uri $uri/ =404;


Advertisement. Scroll to continue reading.

Step-11 : Check the Configuration file.

If Some error occurred they show the problem having configured line.

[root@techbrown conf.d]# nginx -t

It will show given output

Syntax OK

Step-12 : When you completed restart the NGINX services to make changes in the effect.

[root@techbrown conf.d]# systemctl restart nginx

Step-13 : Reload the firewalld to flush the old firewall rules and implement the new one

[root@techbrown conf.d]# firewall-cmd --reload

Step-14 : Check whether the your server is running or not with the allowed domains, Using browser

[root@techbrown conf.d]# firefox

Conclusion : Now you have successfully set up a NGINX web server and now you are ready to launch a website with using a powerful NGINX as a web server. You are now learned how to run powerful website using NGINX as a web server. If you have any issues related to this tutorial feel free to use the comment section below.

Advertisement. Scroll to continue reading.

You May Also Like


How to auto upgrade JioFi firmware for JioFi 2 / JioFi 3 / JioFi 4 / JioFi 5 / JioFi 6 and other JioFi...


Internet is the most important public network for connecting to the WEB. For internet connection requirement the ISP is required as well as it...


How to download and install the Mobile Intel 4 Series Express Chipset Graphics Drivers for Windows 10.  Windows 10 is the one of the...


How to Install and Configure PCSX2 on Windows 10. The Windows 10 is the most recommended operating system for the Games. In stream platform...