How To Install and Configure NGINX Web Server
Using CentOS 8
On my journey to becoming a DevOps Engineer, I have to learn the basics of Linux and how to install a web server so that it is accessible over the internet. During this project, I am going to be demonstrating how to install a NGINX web server using CentOS 8.
Start by opening your terminal-I am using a Mac.
☁️ Next- update the DNF repository cache using the following command:
$ sudo dnf makecache
☁️ Next- we will install NGINX using the following command:
$ sudo dnf install nginx
☁️ You will now see that NGINX install is complete:
☁️ After installing, NGINX services will be (inactive) and (disabled). You can check the status by using the following command:
$ sudo systemctl status nginx
☁️ We will go ahead and start the services by using the command:
☁️ You can now run the status command again to see that it is ACTIVE.
☁️ Lets enable NGINX to the system startup by using:
$sudo systemctl enable nginx
☁️ In order to allow access to HTTP and HTTPS, we need to configure the firewall. Start allowing access by using:
$sudo firewall-cmd — reload
☁️ Now that you have your web server, you want to test your ip address. The first command I used gave me a private ip address-which will not work on a test page-
$ ip a
☁️ To fix this, I had to use a different command in order to show my public ip address:
$ curl -4 icanhazip.com
☁️ You can now go to http://(your ip address) to test your page!