XAMPP Apache配置

本文详细介绍了如何在XAMPP环境下配置Apache服务器,包括httpd.conf文件和httpd-vhosts.conf文件的具体设置方法,以及如何在hosts文件中添加域名映射。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、E:\xampp\apache\conf下 httpd.conf 的配置如下

1、将   Include conf/extra/httpd-vhosts.conf    前边的注释去掉

2、设置根目录   DocumentRoot "E:/workspace"

<Directory "E:/workspace">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

二、E:\xampp\apache\conf\extra下 httpd-vhosts.conf 的配置如下

<VirtualHost *:80>
  ServerAdmin www.statistics.com
  DocumentRoot "E:/workspace/Sma_Statistics/MarketingManage"
  ServerName statistics.com
  ServerAlias www.statistics.com
  ErrorLog "logs/web.log"
  CustomLog "logs/web.log" common
</VirtualHost>
如果项目路径不是根目录,则需加上以下红色部分配置
<VirtualHost *:80>
  ServerAdmin www.tp.com
  DocumentRoot "E:/workspace1/TPStudy"
  <Directory />  
      AllowOverride All  
      Order deny,allow  
      Allow from all  
      Require all granted  
  </Directory>

  ServerName tp.com
  ServerAlias www.tp.com
  ErrorLog "logs/web.log"
  CustomLog "logs/web.log" common
</VirtualHost>

三、C:\Windows\System32\drivers\etc下 hosts 的配置如下

127.0.0.1             www.tp.com




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值