 |
 |
 |
 |
| Programming & Packaging A place to discuss programming and packaging. |

8th June 2012, 05:06 PM
|
|
Registered User
|
|
Join Date: Feb 2012
Location: China
Posts: 7

|
|
[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
|

8th June 2012, 05:10 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Location: Alkmaar The Netherlands
Posts: 193

|
|
|
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
|

8th June 2012, 05:27 PM
|
|
Registered User
|
|
Join Date: Feb 2012
Location: China
Posts: 7

|
|
|
Re: [Help]I really confused about the permission of DocumentRoot in Apache
Quote:
Originally Posted by hmmsjan
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.
|

8th June 2012, 06:27 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Location: Alkmaar The Netherlands
Posts: 193

|
|
|
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
|

9th June 2012, 12:33 AM
|
|
Registered User
|
|
Join Date: Apr 2010
Location: Earth
Posts: 857

|
|
|
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
|

9th June 2012, 02:33 AM
|
|
Registered User
|
|
Join Date: Feb 2012
Location: China
Posts: 7

|
|
|
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
|

9th June 2012, 04:55 PM
|
|
Registered User
|
|
Join Date: Feb 2012
Location: China
Posts: 7

|
|
|
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.
|

9th June 2012, 07:09 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Location: Alkmaar The Netherlands
Posts: 193

|
|
|
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
|

10th June 2012, 02:35 AM
|
|
Registered User
|
|
Join Date: Feb 2012
Location: China
Posts: 7

|
|
|
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"
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 01:53 (Sunday, 19-05-2013)
|
|
 |
 |
 |
 |
|
|