How do I fix the error 403 I am getting with XAMPP while I am using mod_userdir?
Solution 1
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.
Solution 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
Solution 3
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.
Related videos on Youtube
Eric
Updated on September 18, 2022Comments
-
Eric over 1 year
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
somod_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?
-
donquixote over 9 yearsThis 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?