Aug 29, '12 07:30:00AM • Contributed by: canisbos
As mentioned in this hint, Mountain Lion removed the setting in the Sharing preference pane to turn Web Sharing on and off, even though Apache Web Server is still installed by default. That hint also mentions a third-party preference pane that you can install to toggle Web Sharing in Mountain Lion.
Here's another solution in the form of an AppleScript. If you copy the script to a .scpt file in ~/Library/Scripts, you can conveniently toggle Web Sharing by selecting the script in the Scripts menu.
Here's the AppleScript:
The script uses the free Terminal-Notifier app by Eloy Durán, if installed, to notify you that Apache Web Server has been started or stopped. If you have the app installed somewhere other than /Applications, be sure to edit the app's path in the script.
Note that the state of Web Sharing is persistent across reboots, whether you use this method to control it or the aforementioned preference pane.