apache - WAMP Server: What am I doing wrong?

12
2013-08
  • user2434029

    I am brand new to web development...and getting WAMPServer running is a barrier no amount of Googling has helped solve.

    When I install WAMPServer it works fine. When I try to add local domain names, it goes wrong. Can anyone tell me why?

    Things I have tried.

    In

    C:/Windows/System32/drivers/etc/hosts

    I added

    '127.0.0.1 my.testsite'

    Then, in

    C:/wamp/bin/apache/Apache2.2.22/conf/httpd.conf

    I have removed the # from

    '# Include conf/extra/httpd-vhosts.conf'

    Then, in C:/wamp/bin/apache/Apache2.2.22/conf/extra/httpd-vhosts.conf I added

    < Directory C:/WAMPprojects>
    Order Deny,Allow
    Allow from all
    < /Directory>

    and

    < VirtualHost *:80>
    DocumentRoot “C:/WAMPprojects/Hermes”
    ServerName my.testsite
    < /VirtualHost>

    When I enter my.testsite into the address bar, I expect to see the content of the index.html page that’s in the Hermes folder.

    After a fresh install of WAMP where the taskbar icon turns green, I Have made these changes and every time I restart WAMP Server it stops at orange.

    Therefore I have also tried:

    • Turning off Skype
    • Changing Skype settings so it does not listen at port 80 (Tools>Options>Advanced>Connection>Use port 80 and 443 as alternatives for incoming connections. Untick.)
    • Checking nothing else is listening at port 80
    • Changing the port to 8080
    • Changing the port to a different number
    • Adding ::1 to hosts

    I cannot determine what’s going on in the Apache error log.

    I am on Windows XP (SP3) and Apache 2.2.22 Is it a case of incompatibility or can it be fixed?

    Thank you very much in advance if anyone can give me a clue on this - I've been stuck for months now.

  • Answers
  • ernie

    Expanding on my comment:

    The real key here is that when you restart Apache after modifying your conf files, your status icon isn't going green - this is most likely due to an issue with your configuration files (meaning you wouldn't have needed to futz around with Skype, ports, etc) - debug efforts should focus on the Apache conf files. I'm not sure where the errors with conf files get logged in WAMP, but I'd take the time to figure that out now if I were you . . .

    I think the issue is that <directory> sections can't be top level in included conf files. As stated in the documentation, their context is server config or virtual host, meaning it needs to either be in the main conf file (i.e. httpd.conf) or in a <VirtualHost> definition. Try something like this:

    < VirtualHost *:80>
        DocumentRoot “C:/WAMPprojects/Hermes”
        ServerName my.testsite
        <Directory C:/WAMPprojects>
            Order Deny,Allow
            Allow from all
        </Directory>
    < /VirtualHost>
    
  • ultrasawblade

    Here's some detail on what happens when your brower makes a request to a server that should fill in the details:

    • You type http://whatever.invalid in the address bar
    • Browser uses system resolver to issue a DNS request to convert whatever.invalid to an IP address
    • Browser makes HTTP GET request to the IP returned by that DNS request.
    • Within the header of that HTTP GET request, your browser places a "Host:" line, copying the domain name you used, i.e. "Host: whatever.invalid"
    • Apache gets the request, IF the IP was correct.
    • Apache checks the HTTP header for any "Host:" lines and uses the proper vhost, if such a configuration exists.

    So, the piece of the puzzle you are missing is a DNS server willing to take your site name and return the IP on which your Apache server lives, which is currently localhost.

    You could run your own local DNS server, or just dispense with vhosts and use http://localhost or http://127.0.0.1 in your browser.

    Just reread your question more closely and saw that you used the hosts file. Try pinging my.testsite and see if 127.0.0.1 is returned by ping. You may need to remove any existing localhost references in the hosts file. (Incidentally, I just tried a ping -4 localhost on the Windows system I'm on and it did cause a ping to 127.0.0.1 ... so it may be something else ...)


  • Related Question

    windows - WAMP not working anymore
  • Sarfraz

    I had been successfully using WAMP on my PC for a year or so but after I got internet connection through LAN, I noticed that WAMP has stopped working. When I go to http://localhost or http://127.0.0.1 (port is set to 80), the page just keeps on loading indefinitely (of course there are no errors on the page, this is not related to any script errors).

    I tried:

    • Re-installing wamp
    • Re-starting computer
    • Checking to see if port 80 is used by some other program (none used that)
    • I don't use SKype
    • Saw server log of apache; nothing suspicious found
    • Tried running on different browser

    Also all services are running fine.

    What Works:

    • I can access MySQL successfully
    • I can run PHP scripts inside an editor like PHP Designer 2005

    Any ideas please, i have become very dejected, so please help.

    Details:

    Windows XP SP2 with Avira Antivirus

    Thanks in advance.


  • Related Answers
  • Ernestas Stankevičius
    • WAMP is fine.
    • Disable LAN.
    • Disable any chat and community program(steam and so on)
    • Turn off antivirus.
    • Working? No?
    • Renistall windows or try t install wamp on your second partition.