0

I installed LAMP on Fedora 15. I tried to change the DocumentRoot to /home/USER/www, I changed it in the config file. Though it gave me 403 Forbidden error when i try to access the localhost.

How can I solve this issue ?

3 Answers 3

0

You have changed the DocumentRoot setting but have not amended the associated <Directory> and / or <Location> tags in the configuration to allow access to the new location. Amend the paths within the appropriate tags and restart Apache and you'll be fine. See the Apache Manual for details.

2
  • i changed the DocumentRoot "/home/USER/www" & restart apache but still giving the same Error
    – Hamza
    Commented Aug 21, 2011 at 7:10
  • You still need to change the existing <Directory> and / or <Location> settings too, just changing the DocumentRoot is not enough.
    – Mike Insch
    Commented Aug 21, 2011 at 12:49
0

Did you make /home/USER/www/ world viewable? If apache tries to visit your new Document Root it might not have permission to view it.

chmod 711 /home/USER
chmod 755 /home/USER/www
chmod 644 /home/USER/www/*
0

The pretty way would be to edit

/etc/httpd/conf/httpd.conf

and have apache run as user 'USER' instead of user 'apache'. Since you want to have your files there it makes sense doesn't it?

It makes more sense than fiddling with chmod permissions which might end up creating more problems than solutions. I once chmoded the /home folder recursively on an aws ec2 instance to grant permissions to apache and then could not ssh into it anymore because of wrong permissions on my keys...

4
  • you point the fact of making sense, but does it have any impact globally or locally? what else does change resulting from this change? please be as clear as possible. Commented Mar 16, 2013 at 0:09
  • Well obviously if he puts his pages in USER's directory he might as well have them executed with USER's permissions... I reckon when he does his testing he's logged in as USER as well
    – Homezar
    Commented Mar 16, 2013 at 0:32
  • i hope you understand its not for my sake i asked the above, but for future readers. Commented Mar 16, 2013 at 0:33
  • :) I know, and to answer I don't see any potential downfall of this method but I might be wrong
    – Homezar
    Commented Mar 16, 2013 at 0:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .