Set Up / Install
sudo apt-get install nginx
Create a New Directory under /var/www/html
sudo mkdir -p /var/www/html/MyDomain.com/
Create a New INDEX.html under /var/www/html
sudo vi /var/www/html/MyDomain.com/index.html
Create the default INDEX.html page
<html>
<head>
<title>www.MyDomain.com</title>
</head>
<body>
<h1>This is your first virtual host</h1>
</body>
</html>
Create the New Virtual Host File
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/MyDomain.com
Set Up the Virtual Hosts
sudo nano /etc/nginx/sites-available/MyDomain.com
Make changes in the NGINX.conf file
Server {
listen 80;
root /var/www/MyDomain.com/public_html;
index index.html index.htm;
server_name MyDomain.com;
}
Create a symbolic link between the sites-available directory and the sites-enabled directory
sudo ln -s /etc/nginx/sites-available/MyDomain.com /etc/nginx/sites-enabled/MyDomain.com
Restart NGINX
service nginx restart
To create More Virtual Hosts just repeat the above steps.