1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

I need help with Linux hostname resolution

Discussion in 'Linux / BSD / Mac OS X' started by Shodan99, Dec 21, 2011.

  1. Shodan99 New Member

    Joined:
    Mar 11, 2009
    Messages:
    25 (0.01/day)
    Thanks Received:
    0
    Location:
    Largo, Florida
    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?
  2. Shodan99 New Member

    Joined:
    Mar 11, 2009
    Messages:
    25 (0.01/day)
    Thanks Received:
    0
    Location:
    Largo, Florida
    Anybody? I could use some help here.
  3. oily_17

    oily_17

    Joined:
    Sep 25, 2006
    Messages:
    2,313 (0.84/day)
    Thanks Received:
    670
    Location:
    Norn Iron
    Are you using Apache or what web server ?

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

    W1zzard Administrator Staff Member

    Joined:
    May 14, 2004
    Messages:
    14,544 (4.01/day)
    Thanks Received:
    11,216
    you need apache virtual hosts, stuff like

    Code:
    <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
    Last edited: Dec 23, 2011
    Shodan99 says thanks.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page