Linux Ubuntu Nginx Web Server How-to SetUp Virtual Host Easy Guide

July 11th, 2013 by Regaz

This Short Guide Shows You Step-by-Step How-to SetUp a Virtual Host for Nginx Web Server on Ubuntu Linux Distro.

Finally to the article Bottom there is a Link to Guides for Further Nginx Documentation and Examples.

Linux Gnome Penguin Nginx
  1. Open Terminal Window
    (Press “Enter” to Execute Commands)

    Cmd and Search “term”

    Ubuntu Linux Raring Open Terminal
  2. Edit the Sytem Hosts Configuration File
    sudo su
    nano /etc/hosts

    Add a Line Containing Your Server Name:

    127.0.0.1 myservername.com

    Ctrl+x to Save & Exit.

  3. Edit the Default Nginx Configuration File
    nano /etc/nginx/sites-enabled/default

    Add Your Server Configuration:

    server {
        listen 80;
        server_name myservername.com alias www.myservername.com;
        root /data/www;
        index index.html index.htm;

        location /{
            try_files $uri $uri/=404;
        }
    }

  4. Reload Nginx Web Server:

    sudo su -c "nginx -s reload"
  5. Access your New Server on Browser:

    http://myservername.com

    If Also Apache is Running on Port 80 then Possibly Stop It!

  6. To Further Nginx Development Examples Go:

    Nginx Documentation
  7. How-to Install Google-Chrome Browser on Ubuntu:

    Installing Chrome for Ubuntu

Tags: , , , , , , , , , , , , ,