[Deaf-lug] Virtual Hosts

JGJones mailinglist at gwallgofi.com
Sat Jun 21 13:32:20 BST 2008


For your own "domains" such as CMS, Blog etc going to a localhost server 
(on your own PC) you need to configure a site configuration file in 
/etc/apache2/site-available

let's call it cms

and put this in:

<VirtualHost *>
	ServerAdmin webmaster at cms
	ServerName cms
	#ServerAlias www.cms
	DocumentRoot /home/(your user name)/(your web folder)/CMS
	Options Indexes FollowSymLinks MultiViews		
	<Directory /home/(your user name)/(your web folder)/CMS
		AllowOverride All
		Order allow,deny
		allow from all
	</Directory>
</VirtualHost>

/home/(your user name)/(your web folder)/CMS = in my case it's 
/home/jgjones/Sites/CMS

Enable it by sudo a2ensite cms

You also need to add to your /etc/hosts file:

127.0.0.1 cms (add to end of the locolhost line even) so that browser 
know what does cms translate into.

Rapache does all of this automatically so you would find it MUCH easier 
to use that, but I agree...doing it in text allows you to learn Apache2 
better.

Finally, if you are playing with CMS etc in Apache2 on a local computer 
bear in mind - you might find it better to chgrp all files in your web 
folder to www-data (allow apache to write by enabling group-writable).

Group writeable means apache2 can make changes to the files via a 
webbrowser (although you can't actually do this in a browser unless you 
"log in" ie into a blog or whatever you're working on.

Provided you do the above, then default would work (ie http://localhost 
= goes to /var/www) and you can separate the files via virtualhost names.

Hope that's clear and if in doubt, let me know.

Dafydd Eveleigh wrote:
> Thank you very much
> 
> I actually figured it out last night.
> 
> It would appear that the default host overridden the other host so by 
> disabling the default using
> 
> sudo a2dissite default
> 
> It allowed me to set up virtual host for the sites I want. However when 
> I did
> 
> sudo a2ensite default
> 
> the default site no longer comes up!!!!
> 
> It is certainly an a patchy server!!!!! :-)
> 
> I am not worried but would like to work out why to enhance my 
> understanding of apache but not a biggy at the moment.
> 
> I will certainly try the rapache.
> 
> Thank you for sharing my pain.
> 
> On 18 Jun 2008, at 17:22, JGJones wrote:
> 
>> Right...I understand your pain...I'll look at mine BUT in the meantime 
>> why not give this a try:
>>
>> http://en.emanuele-gentili.com/index.php/2008/06/18/rapache-02-1-alpha-packaged/ 
>>
>>
>> rapache aims to provide a GUI interface to configuring Apache making 
>> it vastly much easier.
>>
>> As for your issue...I'll just take a look at my configuration and get 
>> back to you asap (rather busy at the moment) but emailed to let you 
>> know your pain is heard.
>>
>> Dafydd Eveleigh wrote:
>>> Hi fellow ubuntuees
>>> I am trying to set up virtual hosts on my ubuntu 8.04 for personal 
>>> testing and experimentation.
>>> I want to be able to do somthing like http://joomla/ when I want to 
>>> test out joomla or http://wordpress/ when i want to test word press 
>>> and so on. Rather than http://localhost/joomla or 
>>> http://localhost/wordpress.
>>> The server won't be public as it is for messing about and learning 
>>> php and tomcat and so on.
>>> I tried following the instructions set out here
>>> http://ricardocabello.com/blog/post/543/
>>> But when I type in joomla it doesn't go to the root folder which i 
>>> have set up at /home/dafydd/www/joomla and goes to the default folder.
>>> If anybody can provide a simple to use guide that will allow me to 
>>> set up multiple virtualhosts on ubuntu 8.04 that would be a great help.
>>> I am thinking that the problems are caused using the synaptics 
>>> package manager and using a LAMP install. I wonder if it is better to 
>>> install individually using the terminal rather than the package manager.
>>> Many Thanks in advance
>>> Dy
>>> _______________________________________________
>>> Deaf-lug mailing list
>>> Deaf-lug at mailman.lug.org.uk
>>> https://mailman.lug.org.uk/mailman/listinfo/deaf-lug
>>
>> _______________________________________________
>> Deaf-lug mailing list
>> Deaf-lug at mailman.lug.org.uk
>> https://mailman.lug.org.uk/mailman/listinfo/deaf-lug
> 
> 
> _______________________________________________
> Deaf-lug mailing list
> Deaf-lug at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/deaf-lug



More information about the Deaf-lug mailing list