Http://luchanghong.com/article.php? Act = show & id = 24
Now, many of you will not configure Apache, let alone configure an independent domain name locally. Today, I will explain in detail how to configure Apache and then configure the local independent domain name by the way. The so-called local independent domain name is your custom domain name, whatever you like, 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 it locallyProgramFor development, if you want to use many open-source programs, CMS, frameworks, or self-written management systems at the same time, configure an independent domain name for each of them, during the test, you only need to enter the configured domain name in the browser, which is convenient!
Okay. If you don't want to talk about anything else, go to the topic!
The first step is to install the Apache software, and install it in a solid step. Here, let's fill in something. We can write it like this:
Network domain: 127.0.0.1
Server Name: 127.0.0.1
Administrator's email address: Write the previous email address at will)
After the installation is complete, enter localhost or 127.0.0.1 in the local browser to view the it works page! It indicates that Apache is successfully installed.
Second, configure Apache
First, find the Apache configuration file httpd. conf under the apache \ conf \ folder. To modify this file, follow these steps. Do not ask why:
① Find this line: DocumentRoot "D:/Server/Apache/htdocs" and comment out the following lines,
② Locate this line: <directory "D:/Server/Apache/htdocs">, comment out the following lines,
③ Find this line: directoryindex index.html, and write directoryindex. php index.html index.htm index. WML below,
4, find this line: # include CONF/extra/httpd-vhosts.conf, remove the previous #
⑤ Add three lines at the end of the file:
Loadmodule php5_module "D:/Server/PHP/php5apache2_2.dll"
Addtype application/X-httpd-PHP. php
Phpinidir "D:/Server/PHP"
Note: There is no semicolon behind each line, and punctuation marks are all in English.
Then, the httpd. conf configuration is complete, and then configure the httpd-vhosts.conf file, under the apache \ conf \ extra \ Folder
Delete the following:
Add your own independent domain name:
<Virtualhost *: 80>
Options none
Serveradmin 750881560@q.com
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 homepage under the root directory of the website, and a 404 error will occur, you can browse in folders in the site directory without a home page,
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 the last step is to continue.
Find the hosts file under c: \ windows \ system32 \ drivers \ etc, and add your configuration after 127.0.0.1 localhost:
127.0.0.1 localhost
127.0.0.1 guestbook.com
Note: There is a difference between local networks with or without www.
Finally, some new users cannot find the specific lines in the file. We recommend that you use editplus to open the file mentioned above and modify Ctrl + F to find the relevant lines.
OK. Now, follow the steps above to avoid any problems. If you have any questions, leave a message.