2
votes

I am trying to connect to localhost and I am getting the following error on the browsers (chrome and ff and safari)

Browsers connection attempt to localhost was rejected.

i tried

telnet 127.0.0.1

Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

and

Barry$ / : curl localhost

curl: (7) Failed to connect to localhost port 80: Connection refused

the httpd.conf is set to LISTEN : 80

However I can connect using thin on localhost:3000 for a rails project

I've looked at other similar Q's and answers but cannot find a fix.

2
well, if it's set to listen to 80, why do you expect it to connect on 3000? - benomatis
...by the way, don't you think this is a question for http://serverfault.com/? - benomatis
I dont im just saying that connection works for 3000 - Barry McMahon
sorry, i misunderstood... i still think this question has a better place on server fault... - benomatis
ive seen similar q's posted here though - Barry McMahon

2 Answers

1
votes

Check your Apache config with this command:

sudo apachectl -t

This tests the config files and tells you if there's an error. Running sudo apachectl start does not output config file syntax errors to the logs for some reason.

Do u have skype or pow installed ?

0
votes

I just wanted to post my solution to getting localhost working again.

I used the following process to reinstall apache and update the ports. It worked for me so I hope it can help someone else.

I do mention at the bottom that im still getting an unfound url error, so if anyone can help, that would be great.

RE-BUILDING APACHE

port search apache2 Warning: port definitions are more than two weeks old, consider using selfupdate

sudo port uninstall apache2

sudo port -v selfupdate

Ensure that Xcode command line tools are installed or else you get a warning: Warning: The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build.

xcode-select —install

sudo port upgrade outdated

sudo port search apache2

then i did a reinstall of apache2 sudo port install apache2

sudo port load apache2

This got Localhost back up and running on port 80 for me however I'm not out of the woods yet. when i go to my dev sites using

localhost/~barrymcmahon/

im getting the following error

Not Found

The requested URL /~barrymcmahon/php_5_advanced/ was not found on this server.