My virtual host is redirecting to my localhost directory...
I'm using MAMP. I have my document root directory set to /Users/andrew/Sites (which I set in the MAMP control panel) and ports set to 80 and 8889 (couldn't get it to start when I set it to 3306). I have run the setup wizard, which added the line to the MAMP apache file, now I've created a virtual host, and applied the changes. Stopped the MAMP servers and restarted them. now going to my virtual host in my browser, it only takes me to my document root directory. If I type in something random, it says it's not found, so I think it the virtual host is being recognized, but it's just not going to the right place.
What should I do?
What should I do?
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
The company marked this question as answered.
-
Inappropriate?It sounds like Apple's built-in web server is running. That would explain why localhost works but points to the wrong directory. Open up System Prefs, then Sharing, and make sure "Personal Web Sharing" is turned off (unchecked). Give that a try and let me know what happens.
-
Inappropriate?Hmm...something funky is going on. I know I specifically turned off web sharing an hour ago.
I stopped MAMP, and localhost still came up. Then I realized Personal Web Sharing got turned back on somehow. So I turned it off. Then localhost didn't show up. So I added my virtual host (because I had deleted it), applied changes, restarted MAMP, and saw that it didn't work, same thing was still happening. Then I turned off MAMP, and localhost still comes up! I can see that both Web Sharing and MAMP are turned off, yet localhost still comes up. What is going on?? -
Inappropriate?okay another strange thing...i think maybe the page was cached or something because I hit refresh enough times that it worked. But now http://localhost/ redirects to my virtual host... =/
also, i noticed in the MAMP phpinfo() file, it says:
_SERVER["DOCUMENT_ROOT"] /Users/andrew/Sites/myVirtualHost
Shouldn't it say something like: /Users/andrew/Sites ? -
Inappropriate?In VirtualHostX, create a vhost called "localhost" and point it to where it should go. Without that, Apache will serve up the first vhost listed when localhost is accessed (since it doesn't know what to do with localhost).
-
Inappropriate?Yay! Okay that worked like a charm. I thought I had already tried that, but this time, I made sure to drag my localhost virtual host above any of my other virtual hosts. Not sure if that was necessary, but it's working now!
Thank you for your speedy responses!! I would have been up all night trying to figure this stuff out.
Thanks again!
I’m thankful
-
Inappropriate?No problem. Glad I could help :-)
I should probably document this better - the order of your virtual hosts in VHX is the same order they'll appear in Apache. So always make "localhost" top-most. -
Inappropriate?localhost should really be added automatically by default.
I had a completely working virtualhost setup that I was manually editing, and downloaded (and purchased) this product to make things easier and quicker.
VirtualHost didn't import my existing entries (which is fine), but it deleted what I *did* have... including the localhost entry.
I just spent the better part of two hours figuring out why my configuration was no longer working once I installed VirtualHostX.
At my hourly rate, that's a lot more than the $15 I paid for the program.
I suggest either, yes, documenting this immediately... or better yet, changing the software so that it automatically creates the localhost entry (and importing existing virtual hosts would be stellar).
Everything else works great!
I’m frustrated
Loading Profile...



EMPLOYEE
