Linux as server #5 – VPS and virtual hosts

This post is part of Tero Karvinen’s course: Linux as server. Even it is related to school mission it will offer usefull information about GNU/Linux!

VPS (Virtual private server) is virtual machine where you can do anything you like,  not anything but almost. You get slot from server where you can install operating system and you get full acces to it. For example if you choose to install Ubuntu to your VPS you are able to sudo.

If you have multiple domains like I have. You might end to point where you like to route them to same server. Virtual hosts makes it possible to point different domains to different directory in the server. For example and domains are pointing to same server put different directory.


Fifth lesson of Tero Karvinen`s Linux as a server course is passed and we are about to:

  • Register and configure VPS
  • Try virtual hosts

VPS (Virtual private server)

I have already done this section by hosting my own websites on VPS. I decide to rent VPS from linode. 20$ per month and I am able to run my very own server. After I realised how cheap and easy it is to rent VPS I have no intrests to have real hardware. Those days are gone.

My linodes specs:

  • 1GB RAM
  • 8 Processors (1x priority)
  • 48GB Storage
  • 2TB Transfer
  • Cost: 20$
  • Ubuntu 12.04 LTS 64bit

Transfer and cost is per month.

Virtual hosts

I followed linodes documentation. Before starting virtual host configurations I have already registered domain(, made changes to zone files, and added dns records on Linodes DNS manager.

I started by doing new configuration to /etc/apache2/sites-available/

sudo nano /etc/apache2/sites-available/

# domain:
# public: /home/example_user/public/

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/example_user/public/

  # Log file locations
  LogLevel warn
  ErrorLog  /home/example_user/public/
  CustomLog /home/example_user/public/ combined


I am not going to show how my server is configured. Most of all I replaced with my own domain and entered the specific directory where my wordpress contents are.

Config done then I applied them and restarted apache

sudo a2ensite

sudo service apache2 restart

Everything is nice and works while still returns different site!


Karvinen, Tero: Lessons 2013-02-24, Linux as server

Leave a Reply