在配置文件httpd.conf或者子配置文件*.conf中作以下配置
NameVirtualHost *:80
<Directory "绝对路径目录">
Options FollowSymLinks IncludesNOEXEC IndexesDirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.shtml index.aspx default.aspx
AllowOverride None
Order Deny,Allow
Allow from all
</Directory>
<VirtualHost *:80>
ServerName 域名
DocumentRoot "绝对路径目录"
</VirtualHost>
若重启httpd返回错误:Could not reliably determine theserver's fully qualified domain name, using 192.168.1.xx forServerName
则在httpd.conf中找到ServerName *:80开启即可
如果用*号或localhost代替*号,可能要都统一更改,没测试过