1、基于ip地址的虚拟主机
复制代码 代码如下:Listen 80
DocumentRoot /home/1
ServerName
ErrorLog /usr/local/apache/logs/error1_log
CustomLog /usr/local/apache/logs/access1_log combined
DocumentRoot /home/2
ServerName
ErrorLog /usr/local/apache/logs/error2_log
CustomLog /usr/local/apache/logs/access2_log combined
2、基于IP 和多端口的虚拟主机配置
复制代码 代码如下:Listen 172.20.30.40:80
Listen 172.20.30.40:8080
Listen 172.20.30.50:80
Listen 172.20.30.50:8080
DocumentRoot /www/example1-80
ServerName
DocumentRoot /www/example1-8080
ServerName
DocumentRoot /www/example2-80
ServerName
ServerAlias example1.com. *.example1.com
# Other directives here
DocumentRoot /www/example2
ServerName
DocumentRoot "E:/skydao/apache2/htdocs"
ServerName localhost
ServerAlias
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" combined
order allow,deny
allow from all
ServerAdmin kongdaoxian@gmail.com
DocumentRoot "E:/skydao/apache2/htdocs/project1"
ServerName project1.com
ServerAlias
ErrorLog "logs/project1-error.log"
CustomLog "logs/project1-access.log" combined
order allow,deny
allow from all
ServerAdmin kongdaoxian@gmail.com
DocumentRoot "E:/skydao/apache2/htdocs/zendTest/public"
ServerName zendTest.com
ServerAlias
DirectoryIndex index.php
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
ServerAdmin kongdaoxian@gmail.com
DocumentRoot "E:/skydao/apache2/htdocs/testRewrite"
ServerName testRewrite.com
ServerAlias
# DirectoryIndex index.php
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
ServerAdmin kongdaoxian@gmail.com
DocumentRoot "E:/skydao/apache2/htdocs/test"
ServerName test.com
ServerAlias
ErrorLog "logs/zendTest-error.log"
CustomLog "logs/zendTest-access.log" combined
order allow,deny
allow from all



