|
apache php 需要配置环境变量 还有一个dll文件需要copy到windows/system32下
win7 配置虚拟机:经测试成功
1. 打开目录 {Apache2 安装目录}\conf\extra\, 找到 httpd-vhosts.conf 文件.
2. 仿照例子, 添加一段代码来指定某一域名的网站.
#
# DocumentRoot 是网站文件存放的根目录
# ServerName 是网站域名, 需要跟 DNS 指向的域名一致
#
<VirtualHost *:80>
DocumentRoot "F:/wamp/www/test"
#这里配置欢迎首页面
DirectoryIndex index.html index.htm index.php
<Directory />
Options FollowSymLinks
#不许可别人修改页面
AllowOverride None
#设置访问权限
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
3. 打开 httpd.conf 文件, 添加如下语句.
(去掉前面的#号)
# Virtual hosts
Include conf/extra/httpd-vhosts.conf(开启了httpd-vhosts虚拟主机文件,localhost无法打开 需要重新配置一下)
4. 重启 Apache 服务.
5.配置 Hosts文件
////////////////////////////////////////////////////////////////////////////
貌似这个方法不行~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//==================================================
1:apache-->conf-->http.conf 第210行左右 添加
<Directory "E:/code/newhelp/www"> //虚拟路径 寻找index.php
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
2:apache-->conf-->extra-->httpd-vhosts.conf 50行左右添加
<VirtualHost *:80>
DocumentRoot E:/code/newhelp/www //虚拟路径 寻找index.php
ServerName help.baidu.com //虚拟主机域名
</VirtualHost>
3:C:/windows-->system32-->drivers-->etc-->HOST文件 添加
127.0.0.1 help.baidu.com //网址指向本地路径
//-----
4:apache-->conf-->http.conf第280行左右
<IfModule dir_module>
DirectoryIndex index.html index.php //默认直接打开index.html 和 index.php
</IfModule> |
|
|