Yesterday, Chi Ming tried to change the default Web site root folder of Apache, found that the Web page does not appear. Theoretically, it can be changed, because I have never had such an idea, and I have not explored too much at that time. Just now, when I entered the folder suddenly remembered this problem, on the way to achieve a bit, open the Apache configuration file httpd.conf found <directory "D:/apache/htdocs" > To <directory "e:/ Htdocs ">, with Phpinfo (); test, found that the site is denied access, because I used IIS, it is natural to think of the file directory permissions are insufficient, but changed the file directory permissions, the problem has not been resolved.
First, modify the default site Directory of Apache
When Apache HTTP server is installed, the default site directory is located in the Htdocs folder under its installation directory, and the default first page is the index.html file for that folder. For example, my Apache is installed in c:/wamp/bin/apache/apache2.2.21, so my Apache's complete default Site Directory address is C:/wamp/bin/apache/apache2.2.21/htdocs /, the default front page is c:/wamp/bin/apache/apache2.2.21/htdocs/index.html.
Many times, whether it is learning, testing, or to really build their own site, we may not want to put their own site in the Apache default site directory, at this time, this section of knowledge will help you solve this problem.
In httpd.conf find DocumentRoot "D:/apache/htdocs", I change this line to DocumentRoot "E:/htdocs" can.
To modify the method:
1, to the Apache installation directory to find the Conf folder, the folder will httpd.conf such a text document, it is Apache configuration file, responsible for directing the operation of Apache.
2, double hit open httpd.conf This text document, press the keyboard ctrl+f combination to find "DocumentRoot" (with English double quotes, see figure), find out (only one place), the string "DocumentRoot" The strings in the back double quotes are modified to the site directory that you want to set.
such as: Default for DocumentRoot "C:/wamp/bin/apache/apache2.2.21/htdocs", is now modified into DocumentRoot "D:/apache"
3, after completing the 2nd step above, do not close the httpd.conf file, continue to find, look for "<directory" (with double quotes in English, see Figure 3), find "<directory", the first "Directory" The string in double quotes behind the string is modified to the site directory that you want to set.
such as: Default for <directory "C:/wamp/bin/apache/apache2.2.21/htdocs", is now modified into <directory "D:/apache" >
4, at the same time press the keyboard on the Ctrl+s key to save the above changes, you must remember to stop (stop) once Apache service and then start (start), so that just the changes in effect.
To sum up, change the Apache Default Web site root directory only need to change the following two places!
1. Find DocumentRoot "D:/apache/htdocs" To Change "D:/apache/htdocs" to your customized website directory;
2. Find <directory "D:/apache/htdocs" > Change "D:/apache/htdocs" to your customized site directory.