【问题标题】:Apache httpd.conf using defined variable in if statementApache httpd.conf 在 if 语句中使用定义的变量
【发布时间】:2022-01-11 06:16:31
【问题描述】:

我尝试创建一个通用的 httpd.conf,使用 if 语句来决定使用哪个端口。

# In HOME the path of the home directory of the apache user is set
PassEnv HOME

Define HTTPServerPath "${HOME}/HTTPServer"

<If "%{HTTPServerPath} -strcmatch '*something*'">
    Define ListenPort 1080
</If>
<Else>
    Define ListenPort 1180  
</Else>

这不起作用,因为定义行中的变量似乎不可用。如何实现这样的通用配置文件?

【问题讨论】:

  • 我在某个地方找到了&lt;If "'${HTTPServerPath}' -strcmatch '*something*'"&gt; 但这也行不通。结果总是假的。

标签: apache httpd.conf


【解决方案1】:

我没有找到解决方案。现在的解决方法是使用不同的参数启动服务。

服务开始:

httpd start -Dsomething
#httpd start -DsomethingElse.

httpd.conf

<IfDefine something>
...
</IfDefine>
<IfDefine somethingElse>
...
</IfDefine>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 2019-04-23
    • 2018-01-26
    • 1970-01-01
    • 2017-03-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多