Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDoug Hawkinson
Full Stack JavaScript Techdegree Student 25,073 PointsI need to re-establish my localhost environment
I know this has been asked before but no one presented a solution that worked for me. I lost my ability to establish a localhost connection. It was working until the sky fell (long story and probably beside the point). Since then I have tried WAMP, XAMPP and a couple of Bitnami WP bundles. The problem with them is either that MySQL will not reliably start or the packages wont load because of Port conflicts. I have resorted to the instructions in this blog: https://mallinson.ca/osx-web-development/. I am able to get both MySQL and Apache running using his instructions but when I try to connect to a localhost environment I get an error: localhost refused to connect. I've tried Chrome, Safari, Opera and Firefox. They all fail, so I don't think it is a browser problem. If I double click the index.html file in what is my DocumentRoot, the browser window opens showing this path; file:///Users/westcoasthawk/Sites/index.html and I get a big It Works!!! displayed in the window as though the localhost has been connected, but the path clearly indicates it is NOT the localhost. I'm pretty sure at this point that it is one of the .conf file settings used with the Apache Launch, but I have combed over everything I know to look at and I cannot solve the problem. I am including a link to a github repository that has the hosting environment project I am trying to implement with an extra folder (configFiles) the contains what is in all the config files I know about: https://github.com/dhawkinson/home.
Can anyone help? I am losing a bunch of time on this problem and getting nowhere.
Thanks
4 Answers
Doug Hawkinson
Full Stack JavaScript Techdegree Student 25,073 PointsOK! The key is to just keep looking. Here is what got me back to being able to make a localhost connection:
in Terminal (I'm on a Mac), in the apache2 directory:
sudo apachectl -k stop ( stops the web server) sudo cp /etc/apache2/original/httpd.conf /etc/apache2/ ** (copies the original httpd.conf file into apache2 - basically a restore of the original config file) *cp /etc/apache2/original/extra *.conf cp/etc/apache2/extra * (copies all .conf file in the original directory to the extra directory in apache 2 - basically a restore of all original config files) **sudo apachectl restart
This stopped, restored to original version, and then restarted Apache
So localhost is now connecting. I just have to be extremely careful in configuring my vhosts and I should be good to go.
Kevin Korte
28,149 PointsI am by no means an apache expert, and I don't even have apache installed on my current machine to test this, but in your httpd.conf file, line 52, have you tried setting the port number to something other than port 80? Port 8080 would be another common option, but I don't think it'll matter as long as the new port isn't also being used.
What part is MySQL trying to fire on. If my memory serves me, my MySQL would fire on port 3306 and Apache on port 80.
There is a lot of other config files in there that I honestly do not know what they do right now.
Doug Hawkinson
Full Stack JavaScript Techdegree Student 25,073 PointsKevin that was a good suggestion. I had tried that with WAMP but not under the current configuration. MySQL is running on 3306. I tried 8080 for Apache but same problem so I switched it back since I have heard WP sites want Apache on 80.
I appreciate the suggestion though.
Kevin Korte
28,149 PointsDang, no problem. I'll try to pull this when I can and see if it works on my set up. Do you have Skype running? I know that Skype also runs on port 80 and can interfere with Apache.
Doug Hawkinson
Full Stack JavaScript Techdegree Student 25,073 PointsKevin: I have Skype, but I never use it. But, again, a good suggestion. I am thinking about blowing Apache away altogether and reinstalling clean. At this point, I am wondering if Apache has been corrupted somehow.