# How to easily setup virtual hosts (Apache, joomla)?

## adrin

I have Gentoo+Apache+MySql box and I have multiple domains pointing to this server (lets say A.net B.net C.net). By default all those domains 'point' to default htdocs and show "It works!" apache page.

I want B.net to point to /var/www/B.net application which is joomla... how  do I do that? I used:

```
webapp-config -I -h B.net -s apache joomla 1.5.18 

/etc/init.d apache reload

```

and it seems to create /var/www/B.net  properly, but when i open B.net in my browser it still points to "It works!" page and not /var/www/B.net... what is wrong? Do I have to setup virtual hosts manually in apache's config files?

----------

## remkade

Yes you will have to either setup a Vhost or change the default host in the httpd.conf file to point to your joomla installation. I'm not familiar with the webapp-config script you used, since I normally just edit the config file, but if you want multiple hosts to work you will have to first setup NameVirtualHost on the port/ip, and then create a <VirtualHost> block for each host. Its fairly simple really. Here's a really basic one for you:

NameVirtualHost *:80

<VirtualHost *:80>

ServerName b.net

DocumentRoot /var/www/B.net

</VirtualHost>

Then just do the same for the other domains.

----------

