How to Install Virtualhost NGINX Server on CentOS 7

Add the Nginx repository to your server’s list of software sources
If you only need Nginx, you can install it through Nginx’s yum repository:

$ sudo rpm -Uvh

Download and install Nginx, you can use yum to download and install Nginx.

$ sudo yum install nginx

we need to make a directory structure that will hold the site data to serve to visitors:

sudo mkdir -p /var/www/
sudo mkdir -p /var/www/

change the ownership with chown:

sudo chown -R $USER:$USER /var/www/
sudo chown -R $USER:$USER /var/www/
sudo chmod -R 755 /var/www

create demo page on every directory:

nano /var/www/
nano /var/www/

example page:


create NGINX server configuration for virtual host:

sudo mkdir /etc/nginx/sites-available
sudo mkdir /etc/nginx/sites-enabled

include those directory in nginx.conf:

sudo nano /etc/nginx/nginx.conf

add these line:

include /etc/nginx/sites-enabled var WPGroHo = {"my_hash":""};