Friday, November 5, 2010

How to Start or Stop the Apache Web Server on Snow Leopard

These are instructions on how to start, stop, or restart the Apache web server on Snow Leopard.

GUI method:
  1. Open the Sharing prefPane in System Preferences. The checkbox by "Web Sharing" indicates if Apache is started or stopped.
    • To start Apache, check the "Web Sharing" box.
    • To stop Apache, uncheck it.
    • To restart Apache, uncheck then check it.

Command line method:
  1. Open Terminal.
    • Type the following to start Apache:
      sudo apachectl start
    • Type the following to stop Apache:
      sudo apachectl stop
    • Type the following to restart Apache:
      sudo apachectl restart

To test the status of Apache, visit http://localhost in your browser. If the page loads, Apache is started; elsewise it is stopped.

4 comments:

Anonymous said...

This does not work in Lion, how to do it with command on Lion?

Araignée said...

It also works in Lion, being an Apache command instead of an OS X command. I just tried it and was able to stop/start it. The prefPane method is identical in Lion as well.

What error do you get?

Anonymous said...

... does not work on Lion for me too.

No errors with command line, but the server don't start !

Araignée said...

How are you testing if it works? Can you visit http://localhost after starting it? If it shows "It works!", the server is up. Note this does not mean PHP is enabled, just the Apache server. For PHP, see here.

Post a Comment