# Virtual Server



## Lego (Jan 31, 2010)

okay, So I need to host blurr-ink.com and anotherdomain.com, But no matter how I set it up I can't get it to work.  Do I need to have 2 ips to host 2 domains, I thought that I could host 2 domains with ip using virtual servers.  I have created the dns records, created the apache virtualhost but only 1 of the servers only ever works; both domain names work but bring you to the same place even though the directives point to different locations.  I've tried to use virtualmin to setup both and had no luck with that either. could someone point me in the proper direction so I could try again? I could post the current setup but since they don't work, i would rather try to follow proper directions to set it up.


----------



## Lego (Jan 31, 2010)

okay, I have apache setup as http://www.blurr-ink.com working perfect(setup as the default server), with blurr-ink.com setup as a virtual server "Handles the name-based server blurr-ink.com on all addresses" and vbd.blurr-ink.com setup on "Handles the name-based server vbd.blurr-ink.com on all addresses".

Both seem to be working (i need alias vbd. to finish resolving) but I want vbd.com to be hosted by itself not as a subdomain of blurr-ink.com (eg vbd.blurr-ink.com)

Does that make sense?


----------



## Lego (Jan 31, 2010)

Ok currently...

httpd.conf

```
<VirtualHost *>
DocumentRoot "/usr/local/www/apache22/data"
ServerName blurr-ink.com
<Directory "/usr/local/www/apache22/data">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost *>
DocumentRoot "/usr/local/www/apache22/data/vbd"
ServerName vbd.blurr-ink.com
<Directory "/usr/local/www/apache22/data/vbd">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost *>
DocumentRoot "/usr/local/www/apache22/data/vbd"
ServerName violentbydesign.co.cc
<Directory "/usr/local/www/apache22/data/vbd">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
```

named.conf

```
zone "blurr-ink.com" {
        type master;
        file "/etc/namedb/blurr-ink.com.hosts";
        allow-transfer {
                127.0.0.1;
                localnets;
                };
        };

zone "violentbydesign.co.cc" {
        type master;
        file "/etc/namedb/violentbydesign.co.cc.hosts";
        allow-transfer {
                127.0.0.1;
                localnets;
                };
        };
```

violentbydesign.co.cc.hosts:

```
$TTL 3600        ; 1 hour default TTL
violentbydesign.co.cc.  IN      SOA     ns1.blurr-ink.com. admin.blurr-ink.com. (
                        2006051502
                        10800
                        3600
                        604800
                        300 )

; DNS Servers
                IN      NS      ns1.blurr-ink.com.
                IN      NS      ns2.blurr-ink.com.

; MX Records and Exact IP
                IN      A       216.8.128.181

; Machine Names
localhost       IN      A       127.0.0.1
ns1             IN      A       216.8.128.181
ns2             IN      A       216.8.128.181

; Aliases
www             IN      CNAME   violentbydesign.co.cc.
```

vbd.blurr-ink.com isn't pointing to the proper location yet either..


----------



## DutchDaemon (Jan 31, 2010)

You should put vhosts in their own included configuration file: extra/httpd-vhosts.conf.

You will normally have this in there:


```
NameVirtualHost *:80
```

and put virtual hosts in their own containers, each starting with


```
<VirtualHost *:80>
```

If you want two sites to point to the same site (DocumentRoot), just create one virtual host for it, and put the second site in an alias


```
ServerName vbd.blurr-ink.com
ServerAlias violentbydesign.co.cc
```


----------



## Lego (Jan 31, 2010)

ok thanks I'll try that now, I need both site to point to different locations.


----------



## Lego (Jan 31, 2010)

OMG.... your a savior and I can't believe I forgot about that stupid vhosts file... all of it works perfectly again... I feel so dumb right now... everything is fixed. Thanks alot.


----------

