首页 > 开发 > Apache > 正文

apache配置虚拟主机方法

2020-10-12 18:50:41
字体:
来源:转载
供稿:网友

如果你安装的是 wampserver 集成的,那你就进入

wampbinapacheapache2.2.11confextrahttpd-vhosts.conf 配置文件进行如下配置: 意思是配置3个虚拟主机 ,分别是

1、website.localhost:8080  c:usersn.zhangdocumentswebsitedhr3

  1. <virtualhost *:8080> 
  2.   servername website.localhost 
  3.     serveradmin webmaster@test.tools.directhr.net 
  4.     documentroot "c:usersn.zhangdocumentswebsitedhr3" 
  5.  <directory "c:usersn.zhangdocumentswebsitedhr3"
  6.   options indexes multiviews followsymlinks 
  7.   allowoverride all 
  8.   order allow,deny 
  9.   allow from all 
  10.  </directory> 
  11.  
  12.     errorlog "logs/test.tools.directhr.net-error.log" 
  13.     customlog "logs/test.tools.directhr.net-access.log" common 
  14. </virtualhost> 

2、tools.localhost:8080 c:usersn.zhangdocumentstools

  1. <virtualhost *:8080> 
  2.   servername tools.localhost 
  3.     serveradmin webmaster@test.tools.directhr.net 
  4.     documentroot "c:usersn.zhangdocumentstools" 
  5.  <directory "c:usersn.zhangdocumentstools"
  6.   options indexes multiviews followsymlinks 
  7.   allowoverride all 
  8.   order allow,deny 
  9.   allow from all 
  10.  </directory> 
  11.  
  12.     errorlog "logs/test.tools.directhr.net-error.log" 
  13.     customlog "logs/test.tools.directhr.net-access.log" common 
  14. </virtualhost> 

3、test.localhost:8080 c:testphppublic

  1. <virtualhost *:8080> 
  2.   servername test.localhost 
  3.     serveradmin webmaster@test.tools.directhr.net 
  4.     documentroot "c:testphppublic" 
  5.  <directory "c:testphppublic"
  6.   options indexes multiviews followsymlinks 
  7.   allowoverride all 
  8.   order allow,deny 
  9.   allow from all 
  10.  </directory> 
  11.     errorlog "logs/test.tools.directhr.net-error.log" 
  12.     customlog "logs/test.tools.directhr.net-access.log" common 
  13. </virtualhost> 
还有件重要的事情是配置c:windowssystem32driversetchosts

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表