apache default directory modification method.

This article is mainly to introduce the method to modify the default Apache site directory, and can refer a friend in need

Since the collapse of the laboratory blog system, so to consider re-established blog system, a first problem is the original blog system is to install a separate disk above is not installed in the system tray above, however, is usually installed in linux below apache default directory is under / var / www directory, so the first problem encountered here is how to convert apache default installation directory. After find online, I wrote the following summary, mainly for their future encounter the same problem more quickly find, but if you can help people on the can, that's fine. As follows: 

modify the default document directory of apache2 (default is / var / www) 
modify the command: sudo gedit / etc / apache2 / sites-Enabled / 000-default 
found in the document DocumentRoot changes you later want to place the page file directory 
after modification apache2 restart the server, restart the command:  sudo restart /etc/init.d/apache2

more detailed version:

Note: in this paper, Apache HTTP server 2.2.6 Example. About specific installation process Apache HTTP Server 2.2.6 in this I do not speak, if you really want to know or want to get the installer Apache HTTP Server 2.2.6, you can send mail to me, my mailbox is hyiyun @ 139.com. 

First, change the Apache default site directory 

After the Apache HTTP Server is installed, the default site file htdocs directory located in the installation directory folder, the default home page is the index.html file in that folder. For example, my Apache is installed in the C: \ Program Files \ Apache Software Foundation \ Apache2.2 \ inside, so my Apache's complete address is the default site directory 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.
In many cases, whether it is learning, testing, or really want to build your own site, we may not want to put your website under the Apache default site directory, then, knowledge of this section will help you solve this problem. 

Modification method: 

1, to find under the Apache installation directory conf folder, the folder will httpd.conf such a text document (see Figure 1), which is Apache's configuration file, command of Apache running.



2, double-click to open the httpd.conf text document, and then press the Ctrl key + F on your keyboard combination to find " DocumentRoot" "(with quotation marks", see Figure 2), baby name http: //www.bbqmw. after net / qm_yeqm / find out (just one), the string " DocumentRoot string in the back" double quotation marks modify the site directory you want to set. 

Such as: default DocumentRoot "C: / Program Files / Apache Software Foundation / Apache2.2 / htdocs", now modified to DocumentRoot "D: / ApacheTEST"



Figure 2: Find " the DocumentRoot" "string 

3, the above step 2 after that, temporarily do not close the httpd.conf file, continue to look to find " <Directory" "after that, the first" "(with quotation marks", see Figure 3), find the "<Directory" behind Directory "string strings within double quotes for the website directory you want to modify settings. 

Such as: The default is <Directory "C: / Program Files / Apache Software Foundation / Apache2.2 / htdocs">, now modified to <Directory "D: / ApacheTEST" >

Guess you like

Origin www.cnblogs.com/murongyuling/p/10955137.html