Apache configuration independent domain name method

  
                  Today I will explain in detail how to configure Apache and then configure local independent domain names. The so-called local independent domain name is that you customize a domain name, no matter what kind of line, such as: baidu.com, as long as you like, let you play!

So what are the benefits of configuring an independent domain name? Tell you, we do program development locally, we must use a lot of open source programs, CMS, framework, or our own management system, then configure each of them with a separate domain name, as long as the browser input settings in the test A good domain name is fine, convenient and great!

Ok, don't say anything else, go straight to the topic!

The first step, you have to install the Apache software, and then step by step, let you fill in a thing, we can write:

NETWORK DOMAIN : 127.0.0.1

SERVER NAME :127.0.0.1

Administrator's Email Address : Write a mailbox (free to write)

After the installation is complete, enter localhost or 127.0.0.1 in your local browser. You can see that the web page shows It Works!

The second part, configure Apache

First, find the Apache configuration file httpd.conf, under the apache\\conf\\ folder. Modify this file, follow the steps below, don't ask why:

1. Locate this line: DocumentRoot "D:/server/apache/htdocs", comment out the following lines with #:


2. Locate this line: <Directory "D:/server/apache/htdocs">, comment out the following lines, as shown in the figure:


3, find this line: DirectoryIndex index.html, then write the DirectoryIndex index.php index.html index.htm index.wml, as shown below:


4, find this line: #Include conf/extra/httpd-vhosts.conf, remove the previous #

5, add three lines at the end of this file:

LoadModule php5_module "d:/server/php/php5apache2_2.dll" AddType application/x-httpd-php .php PHPIniDir "d:/server/php"

Note format: no points after each line No., punctuation is English

Then, the configuration of httpd.conf is completed, then configure httpd-vhosts.conf this file, in the apache\\conf\\extra\\ folder

Delete the following:


Then add your own independent domain name:

<VirtualHost *:80> Options None ServerAdmin [email protected] DocumentRoot d: \\server\\phpmyadmin ServerName phpmyadmin.com ErrorLog logs/phpmyadmin.com-error_log CustomLog logs/phpmyadmin.com-access_log common php_admin_value open_base_dir "d:\\servr\\phpmyadmin;c:\\windows\\temp" </VirtualHost>

Note: The location of the site file must be accurate. Options None indicates that there is no default home page in the root directory of the website. A 404 error will occur. To remove this item, we can use the folder in the site directory without the home page. The form of browsing, as shown:


We can simplify the configuration as follows:

<VirtualHost *:80> DocumentRoot f:\\www\\guestbook ServerName guestbook.com Php_admin_value open_base_dir "f:\\www\\guestbook;c:\\windows\\temp" </VirtualHost>

Here, it can be said that it is 90%, but it is half a hundred and ninety, continue to finish the last One step

Find C:\\Windows\\ The hosts file under System32\\drivers\\etc, add your configuration after 127.0.0.1 localhost:

127.0.0.1 localhost 127.0.0.1 guestbook.com

Note: bring www and not There is a difference in the local area with www.

Finally, some newcomers can't find the specific line in the file. It is recommended to use Editplus to open the above mentioned file, and modify CTRL+F to find the relevant line.

OK, here, there should be no problem according to the above steps, you can leave a message if you have any questions.

Copyright © Windows knowledge All Rights Reserved