Download http://httpd.apache.org on httpd-2.2.22-win32-x86-no_ssl.msi/
Chinese Reference Manual for http://apache.chinahtml.com/apache2.2
Httpd. conf file
Listen 80
You can set the port number (you can listen to multiple ports at the same time)
Configure virtual directories and Access Permissions
In
<Ifmodule dir_module>
Directoryindex index.html
</Ifmodule>
Add
<Ifmodule dir_module>
Directoryindex index.html index.htm index. php
Alias/myphp "E: \ apache"
<Directory e: \ apache/>
Order deny, allow
Allow from all
</Directory>
</Ifmodule>
Where:
<Directory e: \ apache/>
Order deny, allow
Allow from all
</Directory>
Access permission
You can log out DocumentRoot "D:/program files/Apache Software Foundation/apache2.2/htdocs" without the default home directory.
Configure the VM:
1. Enable the VM configuration file
In httpd. conf, there are:
# Virtual Hosts
Include CONF/extra/httpd-vhosts.conf
2. Add in httpd-vhosts.conf
<Virtualhost 127.0.0.1: 80>
DocumentRoot "E: \ apache"
Directoryindex index.html index.htm index. php
<Directory e: \ apache/>
Options followsymlinks
AllowOverride none
Order deny, allow
Allow from all
</Directory>
</Virtualhost>
The browser parses the address first.
C: \ windows \ system32 \ drivers \ etc \ hosts
Query the relationship between the domain name and the IP address. If not, go to the DNS server.
How to set different domain names in a host to access different pages:
1. Enable the VM configuration file
In httpd-vhosts.conf:
<Virtualhost*: 80>
DocumentRoot "E: \ apache"
# Specify the domain name here
Servername www.baidu1.com
Directoryindex index.html index.htm index. php
<Directory e: \ apache/>
Options followsymlinks
AllowOverride none
Order deny, allow
Allow from all
</Directory>
</Virtualhost>
<Virtualhost*: 80>
DocumentRoot "D: \ apache"
Servername www.baidu2.com
Directoryindex index.html index.htm index. php
<Directory e: \ apache/>
Options followsymlinks
AllowOverride none
Order deny, allow
Allow from all
</Directory>
</Virtualhost>
2. Add the following content to the c: \ windows \ system32 \ drivers \ etc \ hosts file:
127.0.0.1 www.baidu1.com
127.0.0.1 www.baidu2.com
In this way, you can use www.baidu1.com and www.baidu2.com to access different pages respectively.