Mountain Lion (10.8) 移除了「系統偏好設定」→「共享」中的「Web 共享」勾選項,但 Apache 仍內建於系統。以下透過終端機重新啟用並設定使用者 Sites 資料夾:
sudo apachectl restart
username.conf(username 為管理員帳號),內容:<Directory "/Users/你的管理員用戶名/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Sites 資料夾不存在請手動建立:mkdir ~/Sites。username.conf 複製到 /etc/apache2/users/:sudo cp username.conf /etc/apache2/users/
sudo httpd -k start
sudo apachectl restart

https://localhost/~username/ 應顯示 ~/Sites 目錄列表。~/Sites 即可透過瀏覽器存取。/etc/apache2/httpd.conf 載入 php_module(參考文章 45010)。macOS Catalina (10.15) 後 Apache 版本更新,設定檔結構略有不同,但基本邏輯相同。建議正式環境使用 Homebrew 安裝獨立管理的 Apache/Nginx,避免系統更新覆蓋設定。