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 http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
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/yourdomain1.com/html sudo mkdir -p /var/www/yourdomain2.com/html
change the ownership with chown:
sudo chown -R $USER:$USER /var/www/yourdomain1.com/html sudo chown -R $USER:$USER /var/www/yourdomain2.com/html sudo chmod -R 755 /var/www
create demo page on every directory:
nano /var/www/yourdomain1.com/html/index.html nano /var/www/yourdomain2.com/html/index.html
example page:
<html> <head> <title>Welcome!</title> </head> <body> <h1>Success!</h1> </body> </html>
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":""};%d bloggers like this: