phpStudy配置虚拟域名

一、打开虚拟主机配置D:\phpStudy\Apache\conf下的 httpd.conf文件,去掉
#Include conf/extra/httpd-vhosts.conf 前面的 # ,保存即可。
二、打开D:\phpStudy\Apache\conf\extra下的httpd-vhosts.conf文件,删除该文件中的所有内容,接下来复制以下代码粘贴即可。


    ServerAdmin [email protected]
    DocumentRoot "D:\WebPHP"
    ServerName localhost
    ServerAlias localhost
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common


 DocumentRoot "D:\phpStudy\www\test"      // 这里的目录改成你自己的文件目录
 ServerName test.com       //  serverName改成你自己想要的域名


    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all

三、打开C:\Windows\System32\drivers\etc下的hosts文件添加

127.0.0.1       localhost
127.0.0.1       test.com

你可能感兴趣的:(环境搭建)