1 配置虚拟目录
1) 找到PHPStudy安装目录中的PHPTutorial\Apache\conf\vhosts.conf文件;
2) 打开vhosts.conf文件,并在文件最后添加如下的配置信息:
<VirtualHost _default_:80>
DocumentRoot "D:\wamp\PHPTutorial\WWW" #指定虚拟目录路径
ServerName www.cyh.com #虚拟目录绑定的域名
DirectoryIndex index.php #默认首页
<Directory "D:\wamp\PHPTutorial\WWW"> #访问权限设置
Options -Indexes -FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
3) 配置完成之后,重启PHPStudy软件。
2 配置域名解析
1) 找到C:\Windows\System32\drivers\etc\hosts文件;
2) 打开该文件,并在文件最后配置域名:
格式:127.0.0.1 域名
例子:127.0.0.1 www.cyh.com
3) 配置完成之后,重启PHPStudy软件,即可通过域名访问PHP页面。