The method of modifying the Apache default directory. _linux

Source: Internet
Author: User

Because the lab blog system has collapsed, so consider to rebuild the blog system, first encountered a problem is that the original blog system is installed on the top of a stand-alone disk, not installed on the system disk, however, the general Linux installed under the default directory of Apache is in the/var/ www This directory below, so the first problem encountered here is how to convert the Apache default installation directory. After the search on the Internet, wrote the following summary, mainly for their own later encounter the same problems can be faster to find, and if you can help to use the people, it would be better. The method is as follows:

Modify the default document directory for Apache2 (default is/var/www)
To modify the command:sudo gedit/etc/apache2/sites-enabled/000-default
Find DocumentRoot in the document after you modify the directory where you want to place the Web page file
Restart the APACHE2 server after the modification, reboot the command:sudo/etc/init.d/apache2 Restart

more detailed version:

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



2, double hit open httpd.conf this text document, and then press the keyboard ctrl+f key combination to find "DocumentRoot "(double quotes in English, see Figure 2), after finding out (only one place), the string "DocumentRoot"The string within the double quotation marks is 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: Find "DocumentRoot "The string

3, after completing the 2nd step above, do not close httpd.conf file, continue to find, find "<directory "(with double quotes in English, see Figure 3), after you find "<directory", modify the string in double quotes behind the first "directory" string 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.