Advertisement
Promo

Become a member of the ZDNet UK community

Jake Rayson

View blog's RSS Feed

Web design & FOSS

Front-end web technologies and Free Open Source Software.

Wednesday 12 August 2009, 2:22 PM

Virtual Hosts on Ubuntu

Posted by Jake Rayson

Whilst commuting to and from The Agency, through the Garden of England, I have been wanting to build dynamic Joomla! web sites whilst sat on the gloriously over-crowded flu infested train. To do that, I needed to set up local Virtual Hosts on my Ubuntu laptop. This is how I did it (warning, contains command line interface wijjery jiggery):

1. Install Apache2 web server, PHP, MySQL and PHPMyAdmin
For the first 3 items, the easiest way is to enter in the terminal:
sudo tasksel install lamp-server

PHPMyAdmin is a browser-based interface to MySQL which makes it easy to create and edit databases. Just fire up System > Administration > Synaptic Package Manager and do a quick search and install.

2. Set up Name based virtual hosting
You need to sudo gedit the file /etc/apache2/apache2.conf and add this to the end:

# Server name
ServerName 127.0.0.1

# Name based virtual hosting
NameVirtualHost 127.0.0.1:80

3. Create config file example.dev
In the directory /etc/apache2/sites-available/ create a text document named example.dev

  ServerName example.dev
  ServerAlias www.example.dev
  ServerAdmin isp@growdigital.net
  DocumentRoot /home/yourname/Work/www/example.dev

4. Create symlnk to sites-enabled
Once you have configured site, you need to enable it by creating a symbolic link to the sites-enabled folder:

  cd /etc/apache2/sites-enabled/
  ln -s ../sites-available/example.dev

5. Add entry into /etc/hosts
sudo gedit the hosts text file, which points the browser at the right place, by adding:

  127.0.0.1  example.dev

6. Simple restart
Once you've done all that, you need to reboot the Apache2 web server:   sudo /etc/init.d/apache2 restart

Don't forget to actually have a web site set up at /home/yourname/Work/www/example.dev. Now, when I type www.example.dev into my browser, it comes up with my example development web site.

To set up Joomla!, I firstly create an empty database using PHPMyAdmin, and then either use JoomlaPack to re-create my default setup, or do a fresh install of Joomla!

Credit: I used this tutorial from Ubuntu Tutorials to help me on the way.


Comments on this post

Jake Rayson

This member is ranked #5 in our top 100

  • Jake Rayson
  • Web / Multimedia Developer, North Kent
  • Member since: November 2006

Site Activity Rating 6

CoreTechs

Contacts' Latest Discussions

Number of Tracked Discussions: 2,339

ator1940 ator1940

AOL's Steve Case

Wednesday 23 December 2009, 12:31 PM

1 comment
ator1940 ator1940

Plurk holding Microsoft's feet to...

Tuesday 22 December 2009, 3:00 PM

3 comments

Contacts' Latest Blogs

Number of Contacts Blogs: 8

Avatar Adrian Bridgwater

Sun Shines On Cloud Security

Friday 18 December 2009, 12:55 PM

1 comment
Avatar David Meyer

Android passes 20,000 apps mark

Tuesday 15 December 2009, 5:05 PM

0 comments
Avatar Karen Friar

HP workers set dates for strikes

Thursday 3 December 2009, 7:57 PM

1 comment

Skip Sub Navigation Links to CNET Brand Links

Help

Become part of the ZDNet community.

Newsletters