3

I am running Arch Linux and I decided to use XAMPP so I can create and test web pages. Anyway, I followed the instructions given in the site and extracted it to /opt/lampp and I also uncommented the line in /opt/lampp/etc/httpd.conf so mod_userdir will be enabled.

Now, when I try to access my user public_html (via http://localhost/~user), I get this error:

Access forbidden!

    You don't have permission to access the requested object. It is either 
    read-protected or not readable by the server.

    If you think this is a server error, please contact the webmaster.

Error 403

How do I get this to work?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Eric
  • 839
  • 4
  • 13
  • 19

3 Answers3

5

You need to make the public_html and the files there readable by the web server.

One way is to run chmod o+x /home/user (allow everyone to switch to the home directory) and chmod -R o+rX /home/user/public_html (make public_html and files there readable by everyone).

If you need better access controls, use ACLs.

jofel
  • 26,513
  • 6
  • 65
  • 92
2

You need to use this

<Directory "/Users/*/Sites">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

make sure you use Require all granted instead of

Order allow,deny
Allow from all

when using apache >2.4

dersimn
  • 325
  • 3
  • 8
  • This did the trick. But I wonder why this is not in any of the tutorials I found. And what does "Require all granted" even mean? – donquixote Jan 13 '15 at 01:27
1

The default httpd.conf file makes all directories unavailable:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

You need to configure Apache to allow access to your directory(s):

<Directory "/srv/httpd/htdocs">
    Order allow,deny
    Allow from all
</Directory>

That's at a minimum. You might have to do some other things. Get the 403 response, then look in /var/log/httpd/error_log (or wherever XAMPP puts it) to see what went on.