apache 2.4
#虚拟主机配置文件
<VirtualHost *:80>
#绑定的主域
ServerName bookstore.com
#绑定的子域名
ServerAlias www.bookstore.com
#网站主目录
DocumentRoot /var/www/www.bookstore.com/
#日志路径配置(如果没有,请记得创建)
ErrorLog /var/www/web_log/error_bookstore.com.log
CustomLog /var/www/web_log/custom_bookstore.com.log common
#ServerSignature Off
</VirtualHost>
#网站的配置
<Directory "/var/www/www.bookstore.com/">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
apache 2.2
NameVirtualHost :80
<VirtualHost :80>
ServerAdmin [email protected]
DocumentRoot "C:/Program Files/Apache2/docs/dummy-host.www.phpStudy.net"
ServerName dummy-host.www.phpStudy.net
ServerAlias www.dummy-host.www.phpStudy.net
ErrorLog "logs/dummy-host.www.phpStudy.net-error.log"
CustomLog "logs/dummy-host.www.phpStudy.net-access.log" common
</VirtualHost>
原文地址:http://blog.51cto.com/13647930/2086811