Default php path configuration for Fedora20

Source: Internet
Author: User
Tags 403 forbidden error
Hello, everyone. I installed the default php + apache + mysql on fedora 20. I encountered the following problems when changing the default document path of apache: 1. SELinux security permissions; 2. change related folder permissions. I set the relevant SELinux permissions according to the error log prompt and use chmod. after chron changes the related permissions, the prompt is 403 forbidden .. What should I do next?

Specifically, I have completed the following steps:
1. set SELinux permissions:
Setsebool-P httpd_read_user_content 1
Setsebool-P httpd_enable_homedirs 1
2. use chmod and chron to change the directory permissions (my directory is ~ /Www/, place page scripts and page files in ~ The root permission has been obtained in the/www/html directory ):
# Chmod 755 ~ /Www
# Chmod 755 ~ /Www/html
# Chron-R-t httpd_sys_content_t ~ /Www
# Chron-R-t httpd_sys_content-t ~ /Www/html
# Cd ~ /Www/html
# Touch index.html
3. modify the httpd. conf file:
DocumentRoot ".../www/html"

Options Indexes FollowSymLinks
AllowOverride None
Order allow, deny
Allow from all



Options Indexes FollowSymLinks
AllowOverride None
Order allow, deny
Allow from all



Options Indexes FollowSymLinks
AllowOverride None
Order allow, deny
Allow from all


After saving and restarting the apache service, the error 403 forbidden is still returned. What should I do next? All methods on the Internet have been tried and are useless. I am a newbie. please enlighten me. thank you very much.


Reply to discussion (solution)

Are you sure you have no problem with the php environment? $ Php-v

Are you sure you have no problem with the php environment? $ Php-v
No problem. If I create a php file under the default/var/www/html file, it can be run.

You can create index. php in www/html /.
Echo phpinfo ();
?>
Is there an error?

As for 403,

$ Ll.../www/
Paste the result to see

Or

Find the following two statements in the configuration file:

User deamon
Group deamon

Because of the existence of these two statements, apache does not have the permission to read and write the current user's directory.

Change them
User currentUser (currentUser is the user name of the current user)
Group currentGroup (currentGroup is the name of the group where the current user is located. if you do not know the name of the group, you can use the groups command to query the group name)

You can create index. php in www/html /.
Echo phpinfo ();
?>
Is there an error?

As for 403,

$ Ll.../www/
Paste the result to see

Or

Find the following two statements in the configuration file:

User deamon
Group deamon

Because of the existence of these two statements, apache does not have the permission to read and write the current user's directory.

Change them
User currentUser (currentUser is the user name of the current user)
Group currentGroup (currentGroup is the name of the group where the current user is located. if you do not know the name of the group, you can use the groups command to query the group name)
Or not. After following your steps, enter localhost in the address bar to display the apache default test page (not displayed originally), but enter localhost/index.html or index. php still reports the 403 forbidden error.

The current file structure is as follows:
[Root @ localhost lanhyde] # ll www
Total Usage 4
Drwxr-xr-x. 2 lanhyde 4096 14:09 html
[Root @ localhost lanhyde] # cd www
[Root @ localhost html] $ ls-Z
-Rw-r --. lanhyde unconfined_u: object_r: httpd_sys_content_t: s0 index. php
-Rw-r --. lanhyde unconfined_u: object_r: httpd_sys_content_t: s0 index. php ~
-Rw-r --. root unconfined_u: object_r: httpd_sys_content_t: s0 log.txt
-Rwxr-xr-x. root unconfined_u: object_r: httpd_sys_content_t: s0 mypol. pp
-Rwxr-xr-x. root unconfined_u: object_r: httpd_sys_content_t: s0 mypol. te
[Lanhyde @ localhost html] $ ll
Total usage 16
-Rw-r --. 1 lanhyde 20 14:18 index. php
-Rw-r --. 1 lanhyde 0 January 13 14:18 index. php ~
-Rw-r --. 1 root 1278 January 13 13:58 log.txt
-Rwxr-xr-x. 1 root 939 14:02 mypol. pp
-Rwxr-xr-x. 1 root 219 January 13 14:02 mypol. te

-Rw-r --. 1 lanhyde 20 14:18 index. php
Change
Try chmod 755 file or chmod 777 file
-Rwxr-xr-x 1 root
-Rwxrwxrwx 1 root

-Rw-r --. 1 lanhyde 20 14:18 index. php
Change
Try chmod 755 file or chmod 777 file
-Rwxr-xr-x 1 root
-Rwxrwxrwx 1 root
I tried it, no matter how it works...


-Rw-r --. 1 lanhyde 20 14:18 index. php
Change
Try chmod 755 file or chmod 777 file
-Rwxr-xr-x 1 root
-Rwxrwxrwx 1 root
I tried it, no matter how it works...
Paste the effect after your operation.



-Rw-r --. 1 lanhyde 20 14:18 index. php
Change
Try chmod 755 file or chmod 777 file
-Rwxr-xr-x 1 root
-Rwxrwxrwx 1 root
I tried it, no matter how it works...
Paste the effect after your operation.
Sorry, it takes so long to reply. I have solved the problem by using the information provided by other websites. Thank you very much.

Post my reference address to provide some help for kids shoes with the same problem: http://www.if-not-true-then-false.com/2010/enable-apache-userdir-with-selinux-on-fedora-centos-red-hat-rhel/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.