一、配置host文件:
C:\WINDOWS\system32\drivers\etc,打开hosts,添加访问虚拟主机的域名,如127.0.0.1 local.guodaifu.com,
local.guodaifu.com是你要访问的域名
二、打开D:\AppServ\Apache2.2\conf\httpd.conf,在注释掉(1)ServerName www.xxx.com:80 (这个域名是在安装apache时填写的),既是在前面添加"#"(2)DocumentRoot "d:/AppServ/www",也是添加"#"(3)注释掉:<Directory "d:/AppServ/www/web/TPL">和</Directory>之间所有的内容行
三:apache本身是模块话的,正规的是把Include conf/extra/httpd-vhosts.conf前面的#去掉,我是直接在httpd.conf文件添加的,这是我介绍的不同其他在Apache2.2\conf\extra\httpd-vhosts.conf配置虚拟主机原因之一
在D:\AppServ\Apache2.2\conf\httpd.conf最底部添加
NameVirtualHost *:80
<VirtualHost *:80>
ServerName local.guodaifu.com DocumentRoot "D:/AppServ/www/web/guodaifu" (此处是你要配置虚拟主机的目录路径) <Directory "D:/AppServ/www/web/guodaifu"> (此处是你要配置虚拟主机的目录路径) Options FollowSymLinks IncludesNOEXEC Indexes DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml (服务器结尾类型,如PHP的就是.php) AllowOverride Options FileInfo Order Deny,Allow Allow from all </Directory> </VirtualHost>
至此,配置完成了。
![]() |
apache配置,保你配置成功
最新推荐文章于 2022-11-22 10:01:43 发布