1 #-----------adxssp------------# 2 NameVirtualHost *:80 34 ServerName www.b.com 5 DocumentRoot "/Users/renxing/www/adxssp/src/www" 6 7 89 Options Indexes FollowSymLinks10 AllowOverride All11 Order allow,deny12 Allow from all13 14 15 #-----------test------------#16 NameVirtualHost *:801718 ServerName www.t.com19 DocumentRoot "/Users/renxing/www/test"20 21 2223 Options Indexes FollowSymLinks24 AllowOverride All25 Order allow,deny26 Allow from all27 28 29 #-----------admin------------#30 NameVirtualHost *:803132 ServerName www.a.com33 DocumentRoot "/Users/renxing/www/admin/src/www"34 35 3637 Options Indexes FollowSymLinks38 AllowOverride All39 Order allow,deny40 Allow from all41 42 43 44 45 #-----------developer------------#46 NameVirtualHost *:804748 ServerName www.c.com49 DocumentRoot "/Users/renxing/www/developer/src/www"50 51 5253 Options Indexes FollowSymLinks54 AllowOverride All55 Order allow,deny56 Allow from all57 58 59 60 61 62 #------------ 错误显示 -----------#63 php_flag display_errors on64 php_value error_reporting 2039
如上所示,共配置了4个虚拟主机:
www.a.com
www.b.com
www.c.com
www.t.com
如果我本机 的IP地址是:192.168.1.123
那么在 局域网内访问此IP看到的网站就是上面配置中第一个配置的虚拟主机,本案例中就是:www.b.com
如果想要访问别的虚拟主机,那么只需要把对应的主机放置到最前面即可!