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.