Apache service 403 Forbidden

Source: Internet
Author: User

In fedora14, an Apache + MySQL + PhP environment (installed using the source code) was set up. To facilitate development, I want to change the Apache working directory to the current user directory.
/Home/currentuser/htdocs ("currentuser" is the name of the current user)

I modified the Apache configuration file.
/Usr/local/apache2/CONF/httpd. conf (where/usr/local/apache2 is my Apache installation path)

Modify as follows:
# DocumentRoot "/usr/local/apache2/htdocs" comment out the original working path
DocumentRoot "/home/currentuser/htdocs": change the working path to the path set by yourself.

#
# This shoshould be changed to whatever you set DocumentRoot.
#
# <Directory "/usr/local/apache2/htdocs"> comment out the original directory settings
<Directory "/home/currentuser/htdocs"> set the new directory

In this case, save the configuration file and restart the apache service to complete the modification.

However, when I access the service, the webpage returns an error page with the error 403 forbidden. The following description shows that I have no permission to access and modify resources.

The first thing I think of is the read and write permissions of the Directory, So I modified the permission to change the directory.
Chmod 777/home/currentuser/htdocs-R)

However, the problem persists. Why?

I found a lot on the Internet, and finally found the problem, or the problem of httpd. conf configuration.
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)

 

In this way, you can access the working directory by running Apache as the current user.

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.