Skip navigation

Apache- Forbidden Access 403

9301 Views 17 Replies Latest reply: Jan 18, 2014 6:28 AM by Nikola Schmidt RSS
1 2 Previous Next
hrajpathak Calculating status...
Currently Being Moderated
Nov 19, 2012 2:19 PM

I have Macbook Pro with OSX 10.8.2.

 

I am trying to get the Apache2 server running. I did necessary steps and for http//localhost it gives me a successful message saying "It works!"

 

Problem happens when I try to get it work for localhost/~username. I get

 

 "You don't have permission to access /~hrishikeshrajpathak on this server."

 

I explored this problem and came across many posts where people have faced the same issue and it got resolved by adding username.conf file in /etc/apache2/users with following contents:

 

<Directory "/Users/USERNAME/Sites/">
Options Indexes Multiviews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Here I replaced USERNAME by my own user name. I also set the chmod properties. Even after doing all this, I still get the same forbidden error.

 

 

Any pointers where I should be looking for a solution?

 

Thanks!

MacBook Pro, OS X Mountain Lion (10.8.2)
  • etresoft Level 7 Level 7 (23,880 points)
    Currently Being Moderated
    Nov 19, 2012 4:40 PM (in response to hrajpathak)

    Did you restart Apache?

  • etresoft Level 7 Level 7 (23,880 points)
    Currently Being Moderated
    Nov 20, 2012 5:26 AM (in response to hrajpathak)

    What do your home directory permissions look like? What does the Apache log file say?

  • twtwtw Level 5 Level 5 (4,580 points)
    Currently Being Moderated
    Nov 20, 2012 7:23 AM (in response to hrajpathak)

    This is the relevant line:

    [Mon Nov 19 12:43:10 2012] [error] [client ::1] client denied by server configuration: /Users/hrishikeshrajpathak/Sites

     

    So something in your conf files is blocking access. So, a few things to check:

     

    Have you modified the default httpd.conf file in any way? in any way?  It allows user websites by default, but small changes could affect that.

     

    Have you double-checked your user.conf file for typos?  A typo could keep the conf file from being loaded.

     

    Are the permissions for your user.conf file set to root/wheel, and readable by all parties?  again, suspicious permissions could keep the conf from being loaded.

  • jameshoty Calculating status...
    Currently Being Moderated
    Mar 5, 2013 10:15 PM (in response to hrajpathak)

    I am having the exact problem as you had and I check every possible cause. Can you share what did you discover and change that mak it work?

  • jameshoty Level 1 Level 1 (0 points)
    Currently Being Moderated
    Mar 5, 2013 10:42 PM (in response to hrajpathak)

    [Wed Mar 06 14:39:07 2013] [error] [client ::1] client denied by server configuration: /Users/JamesHO/Sites

  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Mar 6, 2013 8:05 AM (in response to jameshoty)

    Have you  looked over this tip   Setting up a local web server on Lion and Mountain Lion

     

    Starting in ML (or possibly Lion) the user conf files are not there by default. So if this is a fresh install and not a migration from an earlier OS then they might be missing.

     

    Look at /etc/apache2/users to see if the conf file is there.

  • jameshoty Level 1 Level 1 (0 points)
    Currently Being Moderated
    Mar 6, 2013 5:31 PM (in response to Frank Caggiano)

    I went throgh 3 rather identical documents about this topic

    1. http://reviews.cnet.com/8301-13727_7-57481978-263/how-to-enable-web-sharing-in-o s-x-mountain-lion/

     

    Attach the following results from the Terminal and hope you find it easy for the troubleshooting.

     

    host-001:~ JamesHO$ whoami

    JamesHO

    host-001:~ JamesHO$ cd /library/webserver

    host-001:webserver JamesHO$ ls -l

    total 0

    drwxr-xr-x  2 root  wheel   68 Aug 25  2012 CGI-Executables

    drwxr-xr-x  5 root  wheel  170 Aug 25  2012 Documents

    drwxr-xr-x  3 root  wheel  102 Aug 25  2012 share

    host-001:webserver JamesHO$ cd documents

    host-001:documents JamesHO$ ls -l

    total 72

    -rw-r--r--  1 root  wheel   3726 Aug 25  2012 PoweredByMacOSX.gif

    -rw-r--r--  1 root  wheel  31958 Aug 25  2012 PoweredByMacOSXLarge.gif

    -rw-r--r--  1 root  wheel     44 Nov  8 13:13 index.html.en

    host-001:documents JamesHO$

     

     

    host-001:documents JamesHO$ cd /etc/apache2/users

    host-001:users JamesHO$ ls -l

    total 16

    -rw-r--r--  1 root  wheel  142 Mar  6 14:48 jamesho.conf

    -rw-r--r--  1 root  wheel  140 Jan 29 14:25 test.conf

    host-001:users JamesHO$ more jamesho.conf

    <Directory "/Users/JamesHO/sites/">

       Options Indexes MultiViews

       AllowOverride None

       Order allow,deny

       Allow from all

    </Directory>

     

    *** Note: In the above code (line 3), I tried both "AllowOverride None and AllowOverride All" but they do not help with the problem

     

    host-001:users JamesHO$ sudo chown root:wheel /etc/apache2/users/*

    host-001:users JamesHO$ sudo chmod 644 /etc/apache2/users/*

    host-001:users JamesHO$ sudo apachectl restart

    host-001:users JamesHO$ httpd -v

    Server version: Apache/2.2.22 (Unix)

    Server built:   Aug 24 2012 17:16:58

     

     

    host-001:~ JamesHO$ cd sites

    host-001:sites JamesHO$ ls -l

    -rw-r--r--  1 JamesHO  staff  49 Mar  6 14:18 index.html.en

    host-001:sites JamesHO$ more index.html.en

    <html><body><h1>My site works</h1></body></html>

    host-001:sites JamesHO$

     

    The line 111 of /etc/aoache2/httpd.conf was also uncommeted

    LoadModule php5_module libexec/apache2/libphp5.so

     

    http://localhost is working

     

    BUT http://localhost/~jamesho is not working

     

    Screen Shot 2013-03-07 at 9.24.01AM.png

  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Mar 6, 2013 6:14 PM (in response to jameshoty)

    Try making the Directory name in the conf file Sites (capital S). The actual directory doesn't seem to matter if it is upper or lower case but you might want to change it also. Then restart hhtpd.

     

    I tried playing around with it here and if it is sites in my comf file I get the permission denied error.

  • jameshoty Level 1 Level 1 (0 points)
    Currently Being Moderated
    Mar 6, 2013 6:27 PM (in response to Frank Caggiano)

    You are right! It's working now.Thank you.

     

    I should be more careful next time

  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Mar 6, 2013 6:25 PM (in response to jameshoty)

    Glad it helped. Sometimes computers can be so picky

1 2 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.