Use Your Mac to Share a Web Site

Enable web sharing on your Mac

Business concept we accept workers.

Kristina Astakhova / Getty Images

Your Mac comes equipped with the same Apache web server software that made its reputation by serving up commercial websites. For a long time, OS X included an easy-to-use interface to the Apache web server that allowed just about anyone to serve up a website with a series of simple mouse clicks.

The basic web sharing service remained part of OS X until the release of OS X Mountain Lion, which removed the simplified user interface but left the Apache web server installed.

Information in this article refers to Mac web sharing using OS X Lion (10.7) and earlier. Apple recommends purchasing OS X Server or macOS Server to return web sharing capabilities to more recent versions of the operating system.

About Creating Your Website in OS X Lion and Earlier

Anyone using OS X Lion (10.7) and earlier can set up web sharing on their Mac.

Web sharing options in OS X

Personal Web Sharing in OS X Lion and Earlier

Your Mac supports two locations for serving up a website. The first is for personal websites created by each user on your Mac. This is an easy way for every member of a family to have a website.

Personal websites are stored in the user's home folder in the Site directory, which is located at ~/username/Site.

Don't go looking for the Site directory just yet. OS X doesn't bother to create the Site directory until it's needed.

Computer Website in OS X Lion and Earlier

The other location for serving up a website goes by the name "computer website," but this is a bit of a misnomer. The name refers to the main Apache documents folder, which contains the data for websites that the web server serves up.

The Apache documents folder is a system-level folder, which is restricted to administrators by default. The Apache documents folder is located at /Library/WebServer. The documents folder's restricted access is the reason why OS X has personal Site folders for each user. Personal Site folders allow users to create, manage, and control their own sites without interfering with anyone else's.

If you intend to create a company website, you may want to use the computer website location, as it prevents others from being able to make changes to the site easily.

Creating Web Pages in OS X Lion and Earlier

Use your favorite HTML editor or one of the popular WYSIWYG web page editors to create your site and store the website you create in your user Site directory or the Apache Documents directory. The Apache web server running on your Mac is configured to serve up the file in the Site or Documents directory with the name index.html.

Enable Web Sharing

To enable web sharing in OS X Lion and earlier:

  1. Click the System Preferences icon in the Dock.

  2. Click the Sharing icon in the Internet & Network section of the System Preferences window.

  3. Place a check mark in the Web Sharing box to turn on web sharing. (OS X 10.4 Tiger calls this box Personal Web Sharing.)

  4. In the Sharing window, click the Create Personal Sites folder button. If the Sites folder is already present from earlier use of the web sharing preference pane, the button reads Open Personal Website Folder.

  5. If you prefer to use the Apache documents folder to serve up a website, click the Open Computer Website Folder button.

Accessing Your Website

The Apache web server starts up and serves at least two websites, one for the computer and one for each user on the computer. To access any of these websites, open a browser and enter one of the following:

  • Use the format http://your.computer.address/ for the computer's web page. To find your computer's address, bring up the Sharing window and highlight the Web Sharing name in the list. Your computer's address displays to the right.
  • Use the format http://your.computer.address/~yourusername for a personal web page. To access it, enter the computer's address from the previous step, followed by the ~ (tilde) character and your username with no spaces in the username or between the tilde and your username.

If you're not sure what your username is, bring up the Sharing window you accessed earlier and highlight the Web Sharing name in the list. Your personal website address displays to the right.

A web sharing solution for users of OS X Mountain Lion (10.8) through macOS Catalina (10.15) is available in OS X Server or macOS Server, which can be purchased in the Mac App Store.

OS X Server or macOS Server for Web Sharing

Even today, Macs ship with an up-to-date version of the Apache web server, ready for anyone to use—just not with a simplified user interface. However, a move to OS X Server (or macOS Server depending on your operating system) returns web sharing capabilities to the Mac.

OS Server for OS X Mountain Lion and later offers a rich collection of server features, including mail server, web server, file sharing, Calendar and Contacts server, Wiki server, and much more.

For Macs running macOS, the macOS Server is available in the Mac App Store for $19.99. Installing macOS Server or OS X Server restores web sharing services to your Mac.