Programme one:
Word Description:
The steps are as follows: For example, Apache server 127.0.0.1 configured as Www.sohu.com First in the HTTPThe. conf file does the following:① Close the default#documentroot "C:/apache2.2/htdocs"② enable httpd-vhosts.conf file#Virtual hosts enable host configuration filesIncludeConf/extra/httpd-vhosts.conf2. In windows/system32/dirvers/etc/the Hosts file adds127.0.0.1 www.hanshunping.com3. In the httpd-vhosts.conf file, add:--Simple Configuration Method<virtualhost 127.0.0.1:80>DocumentRoot"D:/myweb"DirectoryIndex My. html index.html index.htm Index.PHP<directory/>Options followsymlinks allowoverride None Order allow,deny allow from all</directory></virtualhost>--a more complex configuration<virtualhost 127.0.0.1:80>ServerAdmin [email protected]-host2.kk.com documentroot"D:/temp" <directory/>Options followsymlinks allowoverride None Order allow,deny allow to all Satisfy</Directory>ServerName www. hanshunping.com errorlog"Logs/dummy-host2.kk.com-error.log"Customlog"Logs/dummy-host2.kk.com-access.log"Common</VirtualHost>How to control when you enter HTTP in a browser://domain names such as http://infoshare.cn display files for selection, or direct access to the default files.1. Default direct access to a welcome page,as in the previous steps<virtualhost *:80>DocumentRoot"D:/infoshare"#This path can also be htdos the directoryServerName Infoshare.CN directoryindex Index. php#The default is d:/infoshare/index.php .<directory/>Options followsymlinks allowoverride None Order allow,deny allow from all</directory></virtualhost>2.default list instead of direct access to a welcome page2.1 If the virtual directory is in the Htdos directory. <virtualhost *:80>DocumentRoot"D:/myenv/apache/htdos/infoshare"ServerName Infoshare.cn<directory/>Options followsymlinks allowoverride None Order allow,deny allow from all</directory></virtualhost>2.2 if the virtual directory is not in the Htdos directory. <virtualhost *:80>DocumentRoot"D:/infoshare"ServerName Infoshare.cn<directory/>Options Indexes followsymlinks#If you do not join Indexes here, you will be prompted with 403 errorsallowoverride None Order allow,deny allow from all</Directory></VirtualHost>? Special note, if there are two<virtualhost 127.0.0.1:80> matches the first one.
The first step:
Step Two:
Step Three:
Fourth Step: note
Test:
Enter http://www.yxh.com Show First website here is the default 80 port
Input http://www.yxh.cn:81 Show Second website here to specify Port 81
Scenario Two:
The difference from scenario one is that
How to implement multiple domain names with one IP binding