Hosting multiple websites with Apache2 Ubunto Server 10

>cd /etc/apache2/sites-available/
> sudo touch mysitename
>sudo chmod 777 mysitename
>vi mysitename

add following text

NameVirtualHost *:8080

<VirtualHost *:8080>
DocumentRoot /path/to/new/site
ServerName userver.local
</VirtualHost>

save and close the vi editor

>sudo a2ensite mysitefilename
or
>cd /etc/apache2/sites-enabled/
>ln -s /etc/apach2/sites-available/ (target)
>sudo /etc/init.d/apache2 restart
>sudo /etc/init.d/apache2 reload

if virtual host is not working then only one site will work. appache will enable first site comes by alpabatically order in the site-enable folder
so either disable other sites using this command sudo a2dissite Othersites
or give the site name starting 0000sitename so numbers will comes on top in alphabatical order to enable that site.

Resources

http://www.debian-administration.org/articles/412
http://serverfault.com/questions/76766/how-can-i-solve-the-apache2-httpd-error-mixing-ports-and-non-ports-with-a-na
http://ubuntuforums.org/showthread.php?t=794248
https://help.ubuntu.com/community/ApacheMySQLPHP
https://help.ubuntu.com/6.06/ubuntu/serverguide/C/httpd.html
http://www.debian-administration.org/articles/357#virtual_host
http://ubuntuforums.org/showthread.php?t=1057960
http://www.ubuntugeek.com/howto-create-name-based-and-ip-based-virtual-hosts-in-apache.html
http://ubuntu-tutorials.com/2008/01/09/setting-up-name-based-virtual-hosting/

Leave a Reply

Your email address will not be published. Required fields are marked *


four × = 24