SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist bradical1379's Avatar
    Join Date
    Feb 2007
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Issues with creating virtual hosts on Windows 7 machine with WAMP

    I am running into some problems with my virtual hosts set up on my local machine. I am running Windows 7 and Apache 2.2 on the machine.

    This is my hosts file C:\Windows\System32\drivers\etc\hosts :
    Code:
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    
    # localhost name resolution is handled within DNS itself.
    #	127.0.0.1       localhost
    #	::1             localhost
    
    127.0.0.1		localhost
    127.0.0.1		testsite
    This is my httpd-vhosts.conf file:
    Code:
    #
    # Virtual Hosts
    #
    # If you want to maintain multiple domains/hostnames on your
    # machine you can setup VirtualHost containers for them. Most configurations
    # use only name-based virtual hosts so the server doesn't need to worry about
    # IP addresses. This is indicated by the asterisks in the directives below.
    #
    # Please see the documentation at 
    # <URL:http://httpd.apache.org/docs/2.2/vhosts/>
    # for further details before you try to setup virtual hosts.
    #
    # You may use the command line option '-S' to verify your virtual host
    # configuration.
    
    #
    # Use name-based virtual hosting.
    #
    NameVirtualHost *:80
    
    #
    # VirtualHost example:
    # Almost any Apache directive may go into a VirtualHost container.
    # The first VirtualHost section is used for all requests that do not
    # match a ServerName or ServerAlias in any <VirtualHost> block.
    #
    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host.localhost
        DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.localhost"
        ServerName dummy-host.localhost
        ServerAlias www.dummy-host.localhost
        ErrorLog "logs/dummy-host.localhost-error.log"
        CustomLog "logs/dummy-host.localhost-access.log" common
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host2.localhost
        DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost"
        ServerName dummy-host2.localhost
        ErrorLog "logs/dummy-host2.localhost-error.log"
        CustomLog "logs/dummy-host2.localhost-access.log" common
    </VirtualHost>
    
    <VirtualHost *:80>
    	DocumentRoot "C:/httpdocs/test/"
    	ServerName testsite
    	ErrorLog "logs/testsite.log"
    </VirtualHost>
    The issue that testsite and localhost have become the same thing. I can goto http://testsite/test to access the same thing as http://localhost/test

    Any ideas?

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

    Where did you install WAMP?

    I've always advised NOT installing (individual WAMP apps) in a Win7-protected directory as you MUST save files there as the Administrator - not worth the effort.

    What about the httpd.conf file? Were you successful in removing the comment to enable including the httpd-vhosts.conf?

    I didn't see a syntax problem with your code and must assume that Apache is loading so that's verification.

    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

  3. #3
    SitePoint Evangelist bradical1379's Avatar
    Join Date
    Feb 2007
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    brad,

    Where did you install WAMP?
    I am not using a pre-packaged WAMP version like wampserver, rather using stand alone installs of Apache, MySQL and PHP and my Windows & machine.

    C:\Program Files\Apache Software Foundation\Apache2.2
    C:\Program Files\MySQL
    C:\Program Files\PHP

    Hopefully that makes sense.

    Thanks for your help David.

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

    Program Files is the problem because you have to make all your edits of the files there as Administrator. I learned that the hard way and have yet to look back after installing everything (except MySQL) on the W: drive (partition - far, far away from any WinDoze-protected file.

    If you don't believe me, take a look at the httpd.conf and httpd-vhosts.conf and see if they have the edits you made. Have a look at the files located within the htdocs directory, too.

    It's nice that M$ is finally taking security seriously but they make it a real PITA the way they've implemented it.

    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


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
  •