I have followed this guide to set-up Apache on High Sierra: https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/
I used it to set it up on Sierra.
But when I go to http://localhost I get "Hmm. We’re having trouble finding the site "
A suggestion on this similar question: localhost on macOS High Sierra. Which I've tried, but still cannot connect to localhost:(
I tried install mamp and reinstall it then install ampps but still that problem , I write in terminal sudo apachectl start then sudo apachectl stop and again start but nothing changes.
Please help me i tried to solve problems for 2 weeks ago 🙁
Best Answer
You need to do some troubleshooting to find out what's wrong. That error message ("Hmm. We’re having trouble finding the site.") sounds like Firefox having trouble looking up the address for the name "localhost", which is really weird because "localhost" is pretty much built into the operating system. So, first verify that "localhost" is being properly resolved with the command
dscacheutil -q host -a name localhost
-- it should look like this:If the response doesn't list at least the addresses "::1" and "127.0.0.1", something is terribly wrong. (It's ok if it lists additional addresses like "fe80:1::1".) This has nothing to do with Apache. If this is the problem, check your /etc/hosts file; it should contain at least this:
Also, try bypassing the name lookup by trying to reach "http://127.0.0.1/" and "http://[::1]/". If those work, Apache is running and "localhost" lookup is the reason you're getting errors.
If bypassing the name lookup doesn't work, check to see whether Apache ("httpd") is running with the command
ps -ax | grep '[h]ttpd'
If there are no "httpd" processes listed, Apache is not running, and you'll need to troubleshoot further to find out whether it's not starting at all, or starting and getting a fatal error. If it is running, make sure it's listening for network connections with
sudo lsof -a -c httpd -i -sTCP:LISTEN
In the above, all three "httpd" processes are listening for TCP connections on "*:http" -- that is, port 80 (http) on all of this computer's IP addresses. If it lists something else, Apache is running, but the configuration is weird.
Note: none of the above will solve the problem, it's all directed toward finding out what the actual problem is. Once you have a better idea what the problem is, then you can try to figure out how to fix it.