apache配置虚拟主机

1.

Apache基于域名配置虚拟主机:
打开Apache安装目录下的配置文件conf/extra/httpd-vhosts.conf,添加如下配置信息:

  ServerName localhost
  ServerAlias localhost
  DocumentRoot "C:/wamp64/bin/apache/apache2.4.27/htdocs"
  
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  




  ServerName www.weixinapp.com
  ServerAlias www.weixinapp.com
  DocumentRoot "C:/wamp64/bin/apache/apache2.4.27/htdocs/xcxkf2/backend/web"
  
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  




  ServerName www.wxapp.com
  ServerAlias www.wxapp.com
  DocumentRoot "C:/wamp64/bin/apache/apache2.4.27/htdocs/xcxkf2/frontend/web"
  
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  


2.
然后在Apache主配置文件conf/httpd.conf中包含这个配置文件:

  Include conf/extra/httpd-vhosts.conf
3.
需要在hosts文件中加入域名到本地IP地址的映射(hosts文件位置:C:\Windows\System32\drivers\etc):

  127.0.0.1       www.jtw.com

  127.0.0.1       www.wujuntian.com

你可能感兴趣的:(环境及其他)