【问题标题】:How to add Apache2 (XAMPP) runtime argument in Windows如何在 Windows 中添加 Apache2 (XAMPP) 运行时参数
【发布时间】:2016-10-05 09:23:41
【问题描述】:

我正在尝试在 Windows 下为 xampp 设置开发变量以执行此操作:

<IfDefine !development>
  AuthType Basic
  AuthName "Say the secret word"
  AuthUserFile /var/www/hostname/.htpasswd
  Require valid-user
</IfDefine>

在 Linux 上你会这样做

export APACHE_ARGUMENTS=-Ddevelopment

如何在 Windows 上执行此操作?我试过了

set APACHE_ARGUMENTS=-Ddevelopment

但是没有用。

有什么想法吗?

编辑:尝试将启动参数添加到 apache 服务配置,但也没有帮助。

【问题讨论】:

    标签: apache xampp apache2


    【解决方案1】:

    这可能与Apache .htaccess - applying basic authentication conditionally based on environment or hostname 重复

    我已经通过使用“Allow from ....”指令解决了这个问题。

    这样我可以根据 IP 地址全面启用

    这是我的 .htaccess 文件的内容

    Order deny,allow
    Deny from all
    AuthType Basic
    AuthName "Secure Area"
    AuthUserFile "/path/to/file/.htpasswd"
    Require valid-user
    Allow from 127.0.0.1
    Satisfy Any
    

    【讨论】:

      猜你喜欢
      • 2012-03-15
      • 1970-01-01
      • 2019-12-07
      • 2013-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-24
      • 1970-01-01
      相关资源
      最近更新 更多