How to install and use NGINX on CentOS 7.5

By | August 23, 2018

Nginx [engine x]  is free and open source high performance web server. This part of this tutorial series we learn how to install and use NGINX in CentOS latest version (7.5)

Enter your cloud server using putty and login using your cloud server root user name and password 

Step 1: I use my favorite editor nano. First check nano is present in your machine . Writing this following command 

If you see 

that means nano editor not present in your CentOS 7.5 machine . Now you need to download it from yum repository. 

Run command 

then click Ctrl + x then click y . file saved successfully

Step 2:

how to install and use nginx on centos 7.5 How to install and use NGINX on CentOS 7.5 1

Step 3: Start/Stop/ restart nginx server

First enable nginx server by running systemctl command . It start server at boot time 

Sample Output

Start Nginx server

Stop NGINX server

Restart Nginx server

Status Nginx server

Output :

Step 4 : firewall setup

At this point, your server could be vulnerable to unauthorized access by unauthorized users. To fix this, set up a firewall using firewalld. You may need to first install firewalld, which can be done with the following command:

Then, start the firewalld service:

Next, add some firewall rules to allow SSH access to your server, and HTTP and HTTPS connections to Nginx:

Reload firewalld to implement the new firewall rules:

Check everything is working properly below command 

simple output  

then enter your IP or domain address see in browser

how to install and use nginx on centos 7.5 How to install and use NGINX on CentOS 7.5 2

if you see nginx default page that means your setup completed

Some important note for nginx:

  • nginx directory – /etc/nginx
  • Main configuration file – /etc/nginx/nginx.conf
  • Default site config file – /etc/nginx/conf.d/default
  • TCP port for nginx – 80 (HTTP) and 443 (HTTPS)
  • Day 0: Basic instruction of server setup
  • Day 1: How to install and use NGINX on CentOS 7.5
  • Day 2 : We learn how to install PHP versition 7.2 and configure php fpm with nginx
  • Day 3 : We learn how to setup percona 5.7 database server instead of MySQL server
  • Day 4 : We learn how to create virtual host in nginx
  • Day 5: we learn how to setup phpmyadmin in nginx with centOS 7.5
  • Day 6 : We learn How to install nodeJS application in nginx and reverse proxy work

Leave a Reply