Fedora Linux Support Community & Resources Center
  #1  
Old 8th June 2012, 05:06 PM
daozhaocom Offline
Registered User
 
Join Date: Feb 2012
Location: China
Posts: 7
linuxchrome
Unhappy [Help]I really confused about the permission of DocumentRoot in Apache

My system is Fedora17, my username is sp, I installed lampp in /opt/lampp,the default ServerRoot in /opt/lampp/etc/httpd.conf is "/opt/lampp".
I just changed the following places in /opt/lampp/etc/httpd.conf:
Code:
DocumentRoot "/home/sp/workspace"

<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>

<Directory "/home/sp/workspace">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
After I restart the lampp, I received the notice "Access forbidden!"

only when I changed the DocumentRoot to "/opt/lampp/mysite", it worked,but I really hate to set it to a folder under /opt,I really want to set it to a fold under /home/sp.

Help me,plz
Reply With Quote
  #2  
Old 8th June 2012, 05:10 PM
hmmsjan Offline
Registered User
 
Join Date: Jun 2009
Location: Alkmaar The Netherlands
Posts: 235
linuxchrome
Re: [Help]I really confused about the permission of DocumentRoot in Apache

Dear daozhaocom,

Do you have selinux activated? As far I remember, selinux does not like apache access to home directories.

Good luck.
__________________
H.Janssen
Alkmaar
The Netherlands
Reply With Quote
  #3  
Old 8th June 2012, 05:27 PM
daozhaocom Offline
Registered User
 
Join Date: Feb 2012
Location: China
Posts: 7
linuxchrome
Re: [Help]I really confused about the permission of DocumentRoot in Apache

Quote:
Originally Posted by hmmsjan View Post
Dear daozhaocom,

Do you have selinux activated? As far I remember, selinux does not like apache access to home directories.

Good luck.
---------- Post added at 04:27 PM ---------- Previous post was at 04:17 PM ----------

[/COLOR]I just check it.
when iit is enforcing ,I restart lampp ,I received the notice "Access forbidden!".
when it is permissive, I also restart lampp ,I received the notice "Access forbidden!".

Last edited by daozhaocom; 8th June 2012 at 05:40 PM.
Reply With Quote
  #4  
Old 8th June 2012, 06:27 PM
hmmsjan Offline
Registered User
 
Join Date: Jun 2009
Location: Alkmaar The Netherlands
Posts: 235
windows_xp_2003firefox
Re: [Help]I really confused about the permission of DocumentRoot in Apache

Dear daozhaocom,

In permissive mode, you should get a warning message but access will be allowed.
Is it not a trivial permission problem? Apache normally runs under his own user name,
and the file permissions in the users home directory might prevent access, including /home/sp.

Normal document root directory for the webserver is /var/www/html in Redhat based distributions.

Good luck.
__________________
H.Janssen
Alkmaar
The Netherlands
Reply With Quote
  #5  
Old 9th June 2012, 12:33 AM
Fenrin Offline
Registered User
 
Join Date: Apr 2010
Location: Earth
Posts: 890
linuxopera
Re: [Help]I really confused about the permission of DocumentRoot in Apache

you shouldn't use the lampp package, better use Fedora apache server package (package name: httpd). This guide is probably helpful.

the following SELinux flag should be set, if you want to use the home dir
Code:
setsebool -P httpd_enable_homedirs 1
you also have to edit /etc/httpd/conf/httpd.conf:
in the section <IfModule mod_userdir.c> there should be "UserDir enabled" and uncomment the user dir, you want to use (default is public_html).

maybe it works already at this point, but probably you also have to set suitable permissions. For example add your user to the apache group (either edit the file /etc/group or use the user and groups tool).
Then set the permissions for example like this:
Code:
chgrp -R apache /home/username/public_html
chmod -R g+r /home/username/public_html
for folders where you need write access, you should use +rw instead of +r.

if you have any write permission issues.
Code:
chcon -R -h -t httpd_sys_content_t /home/username/public_html
chcon -R -h -t httpd_sys_script_rw_t /home/username/public_html/webapp/folderwhereyouneedwriteaccess
Reply With Quote
  #6  
Old 9th June 2012, 02:33 AM
daozhaocom Offline
Registered User
 
Join Date: Feb 2012
Location: China
Posts: 7
linuxchrome
Re: [Help]I really confused about the permission of DocumentRoot in Apache

Thank you for all , I think i should give up lampp,just use Fedora apache server package,special thanks to Fenrin
Reply With Quote
  #7  
Old 9th June 2012, 04:55 PM
daozhaocom Offline
Registered User
 
Join Date: Feb 2012
Location: China
Posts: 7
linuxchrome
Re: [Help]I really confused about the permission of DocumentRoot in Apache

I have just changed to the apache server package , I solved the problems.so I come back to lampp,I also solve the problems.BecauseI realise that I really made some stupid mistakes as following:
1、 I should never change
Code:
DocumentRoot "/opt/lampp/htdocs"
2、 I should never change
Code:
<Directory "/opt/lampp/htdocs">
I just need to uncomment
Code:
Include etc/extra/httpd-userdir.conf
In /opt/lampp/etc/extra/httd-userdir.conf,make sure
Code:
UserDir public_html
is uncommented

Okay, just restart lampp,enjoy it.
Reply With Quote
  #8  
Old 9th June 2012, 07:09 PM
hmmsjan Offline
Registered User
 
Join Date: Jun 2009
Location: Alkmaar The Netherlands
Posts: 235
windows_xp_2003firefox
Re: [Help]I really confused about the permission of DocumentRoot in Apache

OK, very nice that it's resolved !!

But I assume you access the documents now as "http://server/~sp" ?

In that case, apache switches to user "sp" and accesses the folder as user sp.

In the original config, it should have worked too, provided you use "http://server/" and
the file owner in the homedir is set unconventionally to the user apache is running as , I think.

Good luck
__________________
H.Janssen
Alkmaar
The Netherlands
Reply With Quote
  #9  
Old 10th June 2012, 02:35 AM
daozhaocom Offline
Registered User
 
Join Date: Feb 2012
Location: China
Posts: 7
linuxchrome
Re: [Help]I really confused about the permission of DocumentRoot in Apache

You are right,I access the documents now as "http://server/~sp".When I visit "http://server",it just show me the files under the folder "/var/www/html"
Reply With Quote
Reply

Tags
apache, confused, documentroot, helpi, permission

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change DocumentRoot in Apache ragingsoftware Using Fedora 5 16th September 2011 05:00 PM
changing apache documentroot Aardvark Freak Servers & Networking 2 11th July 2007 03:46 AM
Apache DocumentRoot error Kreichek Using Fedora 2 11th January 2006 09:14 PM
Setting up new DocumentRoot in Apache ltam Using Fedora 2 19th December 2004 07:33 AM


Current GMT-time: 08:11 (Friday, 25-04-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat