'

进入C:\wamp64\wamp64\bin\apache\apache2.4.37\conf\http.conf

首先确保httpd-vhosts.conf扩展文件引入进来了,部分版本默认是不引入 (Include conf/extra/httpd-vhosts.conf前面有#代表没有引入,把#去掉)

 

wamp配置本地多站点。

 

进入C:\wamp64\wamp64\bin\apache\apache2.4.37\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
  ServerName localhost.xyz  #ServerName即是要添加的域名,在本例中也就是localhost.xyz  ,如果别人访问这个域名,那么将被Apache自动解析到${INSTALL_DIR}/www
这个目录下,也就是本例中的DocumentRoot所指定的目录。
#ServerName(必须) 一定要是域名,可以百度域名格式(如果不是域名格式记得在URL后面加个/也可以)
 ServerAlias localhost.com #Alias的中文意思就是别名,这里就相当于给localhost.xyz起个别名为localhost.com,可以是别的域名
#ServerAlias(非必须)一定要是域名,可以百度域名格式(如果不是域名格式记得在URL后面加个/也可以)

DocumentRoot "${INSTALL_DIR}/www" #站点根目录(必须)${INSTALL_DIR}/www替换成你的站点根目录
 <Directory "${INSTALL_DIR}/www/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require local </Directory> </VirtualHost>

 

 

 创建站点目录

创建你的站点目录

wamp配置本地多站点。

wamp配置本地多站点。

 

 wamp配置本地多站点。

 进入http-vhosts.conf

# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

# </VirtualHost>
<VirtualHost *:80>
  ServerName text1.co    //域名配置为text1.co
  ServerAlias localhost.cn  //域名别称为localhost.cn 访问localhost.cn等于访问text1.co
  DocumentRoot "C:\wamp64\Demo\text1"  //站点根目录为C:\wamp64\Demo\text1
  <Directory "C:\wamp64\Demo\text1">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

<VirtualHost *:80>
  ServerName text2.co
  ServerAlias localhost
  DocumentRoot "C:\wamp64\Demo\text2"
  <Directory "C:\wamp64\Demo\text2">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

 

打开浏览器,访问localhost.cn

wamp配置本地多站点。

原因:站点默认为index.php,用t1.php没有权限()

 

 

新建一个wamp配置本地多站点。

写入

wamp配置本地多站点。

 

浏览器重新打开wamp配置本地多站点。

 

 成功了

 

e:/www/team

相关文章:

  • 2022-12-23
  • 2021-09-13
  • 2021-08-21
  • 2021-08-17
  • 2021-11-07
  • 2021-10-17
  • 2022-12-23
  • 2021-05-28
猜你喜欢
  • 2022-02-17
  • 2021-06-09
  • 2021-07-13
  • 2021-07-17
  • 2021-05-31
  • 2021-08-03
相关资源
相似解决方案