Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I set up a local server without MAMP, for various reasons. I used this tutorial: Install and configure Apache, MySQL, PHP and phpMyAdmin on OSX 10.8 Mountain Lion

I'm just wondering why the local IP and localhost resolve to two different locations. Right now the IP resolves to a Virtual Host I set up and the localhost resolves to the DocumentRoot established by httpd.conf

share|improve this question
    
I think you are using the word "resolve" in a non-standard way. Are you talking about what you get from a web server? –  David Schwartz Nov 30 '12 at 3:31
    
I mean that when I type localhost an index file in the DocumentRoot draws. When I type 127.0.0.1 another index page draws, from the DocumentRoot of my Virtual Host. –  Greg Wiley Nov 30 '12 at 3:34
add comment

migrated from stackoverflow.com Nov 30 '12 at 10:42

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote -1 down vote accepted

You've got two (or more) virtual hosts set up. One is set to listen on localhost, the other is set to listen on 127.0.0.1.

Or more likely, one is set to listen on either 127.0.0.1 or localhost, and the other is set to listen on any connection and is picking up whichever the first is not.

Take a look at your virtual hosts - note that virtual hosts can be created in multiple locations on OSX - either under the system as a whole or per-user. You probably want to either remove the virtual host, or set it to listen under both addresses.

share|improve this answer
add comment

Take a look at /private/etc/hosts and make sure that 127.0.0.1 is associated with localhost, like so...

127.0.0.1 localhost
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.