“The connection was refused” Error Message When Using Leopard’s Web Sharing

I came across this problem when trying to enable Web Sharing on my Macbook:

Connection Refused Error

Connection Refused Error

Seems that even if the Sharing Preferences Pane shows that Apache is running, it’s not. A simple Terminal command will show you:


$ ps aux | grep httpd
pmac 1796 0.0 0.0 599820 464 s001 R+ 12:52pm 0:00.00 grep httpd

After a lot of searching, I found the solution. There’s an issue with the Leopard Apache upgrade that somehow forgets to create the log files that Apache needs to start. To fix the problem, type the following commands into Terminal:


sudo touch /var/log/apache2/access_log

sudo touch /var/log/apache2/error_log

sudo chmod 600 /var/log/apache2/access_log

sudo chmod 600 /var/log/apache2/error_log

Restart the Web Sharing Service by unticking and ticking the box is System Preferences or by running the following command in Terminal:


sudo apachectl restart

Apache should be up and running and you can test this by clicking this link: http://localhost. If everything goes to plan you should see the following page:

Apache Start Page

Apache Start Page

Tags: , ,

2 Responses to ““The connection was refused” Error Message When Using Leopard’s Web Sharing”

  1. Elan says:

    Thanks!!! I searched to find this fix. It seams there are a few other bugs that are a lot more common and sifting through them to get here was a bit of work. Your efforts shortened mine. Thanks :D

  2. Paul says:

    You’re welcome Elan. Glad this helped!