phpStudy配置虚拟主机

  1.右击phpStudy->【打开配置文件】->【vhosts-conf】;
  2.在里面加入如下代码,并保存:
 
  NameVirtualHost*:80
 
  <VirtualHost*:80>
 
  ServerNamewww.test.com//你想要显示的域名
 
  DocumentRoot"d:/test/"//目标文件夹
 
  <Directory"d:/test/">//目标文件夹
 
  OptionsFollowSymLinksIncludesNOEXECIndexes
 
  DirectoryIndexindex.htmlindex.htmdefault.htmindex.phpdefault.phpindex.cgidefault.cgiindex.pldefault.plindex.shtml
 
  AllowOverrideOptionsFileInfo
 
  OrderDeny,Allow
 
  Allowfromall
 
  </Directory>
 
  </VirtualHost>
 
  3.右击phpStudy->【打开配置文件】->【httpd-conf】;
 
  4.打开后Ctrl+f搜索vhosts把该行前面的#号删掉,若已删除,请忽略该步骤。
 
  5.请按照C:WindowsSystem32driversetc路径找到hosts文件并打开。
 
  6.在里面加入配置的虚拟域名。
 
  7.重启phpstudy即可。
 
  注意:若无法对hosts文件进行修改,请右击hosts,选择属性,安全,把所有用户的权限都勾选即可修改。