SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Virtual Hosts - what am I missing?

    I know it's essentially pretty straight forward setting up virtual hosts, but I must be missing something, because for the last 5 hours, I cannot for the life of me get it working.

    Here's what I've done:

    1. Editted httpd.conf by uncommenting the httpd-vhosts.conf line

    2. Created two <virtual host> containers in the httpd-vhosts.conf file, like so:

    <VirtualHost *:80>
    DocumentRoot "C:/wamp/www"
    ServerName localhost
    </VirtualHost>

    <VirtualHost *:80>
    DocumentRoot "C:/wamp/www/testSite"
    ServerName testSite.local
    </VirtualHost>

    3. Edited the hosts.txt by adding the following line: 127.0.0.1 testSite.local

    It all seems so straight forward, except that it doesn't work! It says server not found when I go to testSite.local. Localhost works fine and the WampServer is green (though it says offline).

    Please can somebody point me in the right direction! I've been reading the same suggestions all day and they don't seem to apply to my particular issue.

    Thank you!

    -Victor

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,176
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Hi vkloss. Welcome to the forums.

    This is not my area, but I did find this link helpful a while back, so am posting in case it helps you: http://sawmac.com/xampp/virtualhosts/

  3. #3
    SitePoint Zealot imouto's Avatar
    Join Date
    Sep 2004
    Location
    Gotham
    Posts
    184
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi vkloss,

    I've only ever used XAMPP and MAMP, but I'll assume WampServer is very similar. A few things I see that might need tweaking:

    1. In your httpd-vhosts.conf, you shouldn't even need this part:

    Code:
    <VirtualHost *:80>
    DocumentRoot "C:/wamp/www"
    ServerName localhost
    </VirtualHost>
    http://localhost should just work without that part. For your testSite, try this instead in httpd-vhosts.conf:

    <VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "C:/wamp/www/testSite"
    ServerName testsite.local
    ServerAlias www.testsite.local

    <Directory "C:/wamp/www/testSite">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>

    2. I'm not sure what version of Windows you're running, but your hosts file shouldn't have the .txt file extension. It should just be hosts. In Vista it's usually located at Windows\System32\drivers\etc. To edit it you have to run your text editor as an Administrator. You will probably also have to modify the Properties of the hosts file so that "Read-only" isn't checked off. After you change your hosts file, make sure to checkmark "Read-only" back.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    vk,

    The thing that jumped out of your post at me was the "hosts.txt" file. hosts is an extensionless file located in the Windows (i.e., protected) directory so, if you're using any Windows more advanced than XP, you'll need to run your text editor (NOT Notepad) as the administrator so you can save the file (it will not save if not done as the administrator). With that, I think you're set (leave the virtual host definitions in the extras/httpd-vhosts.conf file, though, IMHO).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •