20
Nov
2009
Name Based Virtual Hosts On Apache2 Using Ubuntu
By Jamin. Posted in Apache | 2 Comments »Having your own web server has it’s advantages and disadvantages one of those disadvantages being that the responsibility of correctly configuring all the system features fall on the owner. So in my efforts to keep my web server alive I run across quite a few problems. So I have decide to document them in hopes of saving someone else some time. This article in no way covers all aspects of setting up multiple sites on one server but it is one option.
So today I want to talk about Apache’s NameVirtualHost directive which will allow you to set up multiple sites on one web server. Basically you are just telling Apache that when someone asks for a certain domain name on your server that they get the files in the directory you want them to.
I will assume you have a “www” directory if not you can just make one with mkdir as shown in the code below.
So we will start by adding a few new directories under “www” open a terminal and type the following.
me@myserver:~$ sudo mkdir /home/www/www.example.com me@myserver:~$ sudo mkdir /home/www/www.example.com/log me@myserver:~$ sudo mkdir /home/www/www.example.com/htdocs me@myserver:~$ sudo mkdir /home/www/www.example.com/cgi-bin me@myserver:~$ sudo mkdir /home/www/www.secondexample.com me@myserver:~$ sudo mkdir /home/www/www.secondexample.com/log me@myserver:~$ sudo mkdir /home/www/www.secondexample.com/htdocs me@myserver:~$ sudo mkdir /home/www/www.secondexample.com/cgi-bin







