How to modify the default site directory for Apache __apache

Source: Internet
Author: User

How to modify Apache the default Site directory

(Author: Ewin.) Original, reprint, quote, extract please indicate the source)

Note: This article takes the Apache HTTP Server 2.2.6 as an example. About the specific installation of the Apache HTTP server 2.2.6 I'm not going to say this, if you really want to know or want to get the Apache HTTP Server 2.2.6 installer, you can email me, My e-mail is hyiyun@139.com.

first, modify Apache the default Site directory

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 the C:/Program files/apache Software foundation/apache2.2/, then my Apache's complete default Site Directory address is C:/Program files/ Apache Software foundation/apache2.2/htdocs/, the default home page is C:/Program files/apache Software foundation/apache2.2/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.

To Modify the method:

1, to the Apache installation directory to find the Conf folder, the folder will httpd.conf such a text document (see Figure 1), it is Apache configuration file, responsible for directing the operation of Apache.


Figure 1: Finding the httpd.conf text document

2, double hit open httpd.conf this text document, and then press the keyboard on the CTRL+F key combination to find "DocumentRoot" (with double quotes in English, see Figure 2), 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:/Program Files/apache Software Foundation/apache2.2/htdocs", is now modified into DocumentRoot "D:/apachetest"


Figure 2: Finding the "DocumentRoot" string

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.

For example: The default is <directory "C:/Program files/apache Software Foundation/apache2.2/htdocs", is now modified into <directory "D:/ Apachetest ">


Figure 3: Finding the "<directory" string

4, after the revision, see Figure 4.



Figure 4: After modifying the directory

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

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.