# I need help with Linux hostname resolution



## Shodan99 (Dec 21, 2011)

I set up a new linux server and I am trying to get all my websites up and running again. I have all the DNS pointed to my server but cant get them to pull up specific directorys

ie: 
var/www/html/site1
var/www/html/site2

they all go to the same directory and bring up
var/www/html

how do i get that extra step to pull up the right directory for the right website? is it something in the files
/etc/hosts
/etc/host.conf
/etc/resolv.conf
and if so what do i need to enter to get my domain to pull up the right index file?


----------



## Shodan99 (Dec 23, 2011)

Anybody? I could use some help here.


----------



## oily_17 (Dec 23, 2011)

Are you using Apache or what web server ?

You can set the folder that each site uses in its config IIRC


----------



## W1zzard (Dec 23, 2011)

you need apache virtual hosts, stuff like


```
<VirtualHost 208.43.3.xx:80 10.18.50.xx:80>
ServerAdmin admin@techpowerup.com
[B]DocumentRoot /home/xx/www[/b]
ServerName [B]www.generalnonsense.net[/B]
ServerAlias [B]generalnonsense.net *.generalnonsense.net[/B]
ErrorLog /home/xx/logs/www.xx.net_error_log
CustomLog /home/xx/logs/www.generalnonsense_access_log combined

RewriteEngine On
RewriteCond %{HTTP_HOST}        !www.generalnonsense.net
RewriteRule ^/(.*)$ http://www.generalnonsense.net/$1 [L,R=301]
</VirtualHost>
```

in your apache config file. location depends on your linux distro .. /etc/httpd/conf/httpd.conf on centos/redhat/fedora


----------

