The Web Sharing feature uses the Apache web server application to allow you to run your own web server on your Mac. Many individuals use this capability to host a local web site, web calendar, wiki, blog, or other service. Some businesses use Web Sharing to host work group collaboration features. And many web developers use Web Sharing to test their site designs before moving them to a production web server.
Mountain Lion no longer provides controls for setting up, using, or disabling Web Sharing. The Apache web server is still included with the OS, but you can no longer access it from the Mac's user interface. You can, if you wish, use a code editor to manually edit the Apache configuration files, and then use the Terminal application to start and stop Apache, but for a feature that was click-and-go easy in previous versions of the OS, this is a big step backwards.
If you need Web Sharing, Apple recommends installing OS X Mountain Lion Server. For a very reasonable $19.99, Mountain Lion Server provides much greater access to the Apache web server and its capabilities than was ever available with Web Sharing. But Apple made a huge mistake with Mountain Lion. When you perform an upgrade install, all of your Web Server settings remain in place. This means your Mac can run a web server, but you don't have an easy way to turn it on or off.
Well, that's not entirely true. You can turn the web server on or off with a simple Terminal command, which I include in this guide. But Apple should have provided an easier way to do this, or better yet, continued supporting Web Sharing. Walking away from the feature without providing an off switch is beyond belief.
How to Stop the Apache Web Server With a Terminal Command
This is the quick-and-dirty way to stop the Apache web server used in Web Sharing. I say "quick and dirty" because all this command does is turn the web server off; all of your web site files remain in place. But if you just need to shut down a site that was migrated to Mountain Lion and left running, this will do it.
Launch Terminal, located at /Applications/Utilities.
The Terminal application will open and display a window with a command line.
Type or copy/paste the following text at the command prompt, and then press return or enter.
sudo apachectl stop
When requested, enter your administrator password and press return or enter.
That's it for the quick-and-dirty method for stopping the Web Sharing service.
How to Continue Hosting a Web Site on Your Mac
If you want to continue using Web Sharing, Tyler Hall offers a very handy (and free) system preference pane that lets you start and stop Web Sharing from the more familiar System Preferences interface.
After you download the Web Sharing preference pane, double-click the Web Sharing.prefPane file and it will be installed in your System Preferences. When the installation is complete, launch System Preferences, select the Web Sharing preference pane, and use the slider to turn the web server on or off.
Gain More Web Sharing Control
Tyler Hall created another handy app, called VirtualHostX, which provides much more control over the Mac's built-in Apache web server. VirtualHostX lets you set up virtual hosts or set up a complete web development environment, just the thing if you're new to web design, or if you want a quick and easy way to set up a site for testing.
While it's possible to host web sites from your Mac using Web Sharing and VirtualHostX, there are two additional development and hosting systems that deserve a mention.
MAMP, an acronym for Macintosh, Apache, MySQL, and PHP, has long been used for hosting and developing web sites on the Mac. There's an app with the same name that will install Apache, MySQL, and PHP on your Mac. MAMP creates an entire development and hosting environment that is separate from the utilities Apple provides. This means you won't have to worry about Apple updating the OS and causing a component of your web server to stop working.
OS X Server, currently OS X Mountain Lion Server, provides all of the web serving capabilities you will probably need in one easy-to-use package. Besides web serving, you also get File Sharing, Wiki Server, Mail Server, Calendar Server, Contacts Server, Messages Server, and much more. For $19.99, it's a good deal, but it requires careful reading of the documentation to properly set up and use the various services.
Apple dropped the ball when it eliminated the Web Sharing feature that's been part of OS X since it was first released, but fortunately there are other options available if you want to continue using your Mac for web hosting and development.