View Full Version : [ubuntu] Virtual Hosts, Multiple Domains
December 13th, 2010, 02:35 PM
Hey everybody :D
I purchased several domain names, in the hopes of running multiple websites from the same pc. But then I discovered it was more difficult than I thought!
Is it possible to set up virtual hosts in Apache so that each domain points to a separate folder? For instance, "ubuntustuff.ca" points to "/home/me/ubuntustuff", "myblog.com" points to "/home/me/myblog", etc?
And if so... how??
December 13th, 2010, 04:12 PM
December 13th, 2010, 05:06 PM
As the above link describes you need to look at a VirtualHost of each domain. Then set the Server_Name and DocumentRoot for each of them. Should work a threat
December 14th, 2010, 02:03 AM
Thanks, guys. I'll give that a try, and let you know how it goes.
December 14th, 2010, 01:50 PM
I moved two folders to the /var/www/sites folder, each containing all the files for a website I'm trying to set up. So there's two folders, each containing its own website.
I opened 000-default, deleted everything in the file. Then I copied and pasted the example from the link you sent me, and replaced all of the references to "hello" with the name of one of the website folders (above).I changed ServerRoot to the first domain, and DocumentRoot to the corresponding website folder. Then I did the exact same thing again for the other website, copying the text and replacing with the name of the second website folder in /var/www/sites etc.
Typing the domain of either website in my web browser takes me to the original "It works!" page.
Am I missing something? :confused:
December 14th, 2010, 02:09 PM
... then I rebooted, changed the permissions of both website folders to www-data - should I have done that security-wise? - and both sites now work!
Thank you so much!
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.