403 Forbidden error on Mac web server
Posted: 27/04/12
After upgrading Mac OS, or attempting to start the Web Sharing service for the first time, you may find browsing to your document root causes a 403 Forbidden error to display. This is most likely because the Apache web servers HTTP config file is set to disallow access to the root directory - something that Mac OS should probably be automatically updating for you when you activate web sharing, but ah well!
Follow these steps to modify the Apache config to permit access to the root directory on your web server.
1) Open a Terminal and type sudo nano /private/etc/apache2/httpd.conf then press Return
The Apache HTTP config document is opened in the Terminal window.
2) Press Ctrl+W (where is) and type <Directory />
3) Press enter to perform the search.
The cursor moves to the start of the <Directory> block in the document.
4) Change the line Deny from all to Allow from all
5) Press Ctrl+O
6) Press Return to save the changes
7) Press Ctrl+X to close the document and exit back to the Terminal prompt.
8) Type sudo httpd -k restart at the Terminal prompt to restart your Apache 2 server
Now try browsing to your web root.
If that doesn't work:
By default, on any unix based operating system only root can bind a process to a port below 1024.
Your choices are to either use a port higher than 1023 and remember to specify it when you connect, or to ensure that you start Apache as root.
Follow these steps to enable root user on your OSX user account.
Keywords for this post: mac, osx, web server, apache, terminal, lion, snow leopard, mountain lion, http, forbidden
Popular categories:
Recent posts:
- Mac OS find files using regex
- ADB device driver won't install
- Eclipse: An error has occurred. See the log file .metadata/.log
- Updated blinkbox iPad app
- Nexus 7 doesn't appear in adb devices list
- Improve the keyboard in the Samsung ICS update
- Getting error with manually created NIB?
- Adding/removing items from PATH on Mac
- Presenting at Flash Oxford
- Failed to get the task for process xx
- more...
Publications:
Places you'll find me:
Archive:
- August 2024
- July 2024
- June 2024
- May 2024
- April 2024
- March 2024
- February 2024
- January 2024
- December 2023
- November 2023
- October 2023
- September 2023