windows 下 apache 添加虚拟机
NameVirtualHost 127.0.0.1:80<VirtualHost 127.0.0.1:80>DocumentRoot "F:\www"ServerName localhost <Directory "F:\www"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory></VirtualHost><VirtualHost 127.0.0.1:80>DocumentRoot "F:\www\saier"ServerName saier.com <Directory "F:\www\saier"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory></VirtualHost>
?
一、配置HOST文件
windows/system32/drivers/etc/host
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
127.0.0.1 test
127.0.0.1 www.test2.0.com
二、修改httpd.conf
去掉Include conf/extra/httpd-vhosts.conf前的#注释
若更改APACHE默认网站根目录需要保持
DocumentRoot "D:\web"和<Directory "D:\web">两处一致
三、配置httpd-vhosts.conf
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot "D:\web"
ServerName localhost
?? ?<Directory "D:\web">
?? ??? ?Options Indexes FollowSymLinks
?? ??? ?AllowOverride All
?? ??? ?Order allow,deny
?? ??? ?Allow from all
?? ?</Directory>
</VirtualHost>
<VirtualHost 127.0.0.1:80>
DocumentRoot "D:\web\test"
ServerName test
?<Directory "D:\web\test">
??? Options Indexes FollowSymLinks
??? AllowOverride All
??? Order allow,deny
??? Allow from all
?</Directory>
</VirtualHost>
#采用CAKEPHP架构,test2.0即为app文件夹
<VirtualHost 127.0.0.1:80>
DocumentRoot "D:\web\test2.0\front\webroot"
ServerName www.test2.0.com
?<Directory "D:\web\test2.0\front\webroot">
??? Options Indexes FollowSymLinks
??? AllowOverride All
??? Order allow,deny
??? Allow from all
?</Directory>
</VirtualHost>
四、重启APACHE