Creating a virtual server with nginx

Step 1

cd /etc/nginx/sites-available

Step 2

create file in sites-available directoryfor example

vim xxx.yourdomain.com.conf
server {
listen 80;
server_name xxx.yourdomain.com;
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection ‘upgrade’;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
The above configuration assumes your webserver is running at port 8080

Step 3

ln -s /etc/nginx/sites-available/xxx.yourdomain.com.conf /etc/nginx/sites-enabled/xxx.yourdomain.com.conf

Step 4

sudo nginx -s reload
sudo service nginx restart