#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0

    Unhappy Apache only recognize one domain..


    Hi.!! I had created some webpages for a couple of friends, and I decided to get a dedicated (A fortatrust promotion $10) so I can manage them myself..
    The server came with CentOS 6, apache and Mysql preinstalled, so I just had to install webmin, the ftp users, and the virtualhost as follow:

    NameVirtualHost 190.130.XXX.XXX
    <VirtualHost *>
    DocumentRoot "/home/webpage1/web"
    ServerName www.webpage1 .com
    ServerAlias *.webpage1 .com
    <Directory "/home/webpage1/web">
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>

    <VirtualHost *>
    DocumentRoot "/home/webpage2/htdocs"
    ServerName www.webpage2 .com
    ServerAlias *.webpage2 .com
    <Directory "/home/ webpage2/htdocs">
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>

    <VirtualHost *>
    DocumentRoot "/home/webpage3/web"
    ServerName www.webpage3 .com
    ServerAlias *.webpage3 .com
    <Directory "/home/webpage3/web">
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>

    (The spaces in the web adresses are due to the forum policy, they dont exist in the real file)

    After that, I restart the apache.. then, in Godaddy, I forwarded the domains to my server IP, but It doesnt matter wich of the 3 web addresses I type, it always take me to the webpage1, so I got a couple of questions:
    Do I need to set up something more, for apache to handle the virtualhosts..?
    Ist better to forward the domains or to redirect to a NS address..?
    In order to create a NS address in my server, I need to install BIND or it can be done in other way?
    Thanks in advance for all your help..!!
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4303
    Welcome to DevShed Forums, javier_ns.

    The IP address or "*" in the <VirtualHost> start tags needs to exactly match the value of the NameVirtualHost directive. Reference: http://httpd.apache.org/docs/2.0/vhosts/name-based.html
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0
    Hi Kravvitz, thanks a lot for your answer, but I had already tried that:

    NameVirtualHost 190.130.XXX.XXX
    <VirtualHost 190.130.XXX.XXX>
    DocumentRoot "/home/webpage1/web"
    ServerName www.webpage1 .com
    ServerAlias *.webpage1 .com
    <Directory "/home/webpage1/web">
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>

    And I still having the same issue, any webpage I type, take me to the webpage1..

    Maybe there is something else I need to setup..?
    Thanks again for your answer..
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4303
    Did you restart Apache after you made the change?
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0
    Yes, everytime I make a Change, I restart apache..

IMN logo majestic logo threadwatch logo seochat tools logo