首先安装最新版本的wamp server,这是必须的!
配置默认”www目录”的路径(可选):下面以改为D:site为例。打开wampscriptsconfig.inc.php
第47行,$wwwDir = $c_installDir.’/www’; 修改为:$wwwDir = ‘D:/site’;即可。
配置Apache根目录:C:wampinapacheApache2.2.21confhttpd.conf ->1. DocumentRoot, 例如:DocumentRoot "D:/mzwnew" ; 2.<Directory ,例如:<Directory "D:/mzwnew">
配置虚拟主机:C:wampinapacheApache2.2.21confextrahttpd-vhosts.conf ->例如在最下面添加:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "D:/mzwnew/phpstudy"
ServerName local.phpstudy.com
ServerAlias local.phpstudy.com
ErrorLog "logs/local.phpstudy.com-error.log"
CustomLog "logs/local.phpstudy.com-access.log" common
</VirtualHost>
配置HOST:C:WindowsSystem32driversetcHOSTS, 例如:127.0.0.1 local.phpstudy.com
然后在D:/mzwnew/phpstudy目录下新建文件 index.html(默认)
最后打开浏览器,地址栏输入:local.phpstudy.com
奇迹出现: