如何为Apache模块定义自定义配置指令?

Com*_*sNo 4 c c++ apache delphi apache2

我想要做的是从httpd.conf传递一些设置到我的模块,如:

<Location /path>
  SetHandler mymodule-handler # based on this, the module will kick in and "try" to read settings
  MyCustomStringSetting "AStringValue"
  MyCustomIntegerSetting 2012
  # more
</Location>
Run Code Online (Sandbox Code Playgroud)

如何从模块中获取"AStringValue"和"2012"?

mjn*_*mjn 6

以下是"Apache:The Definitive Guide"中的完整示例(包含源代码):

http://docstore.mik.ua/orelly/linux/apache/ch15_04.htm

示例模块mod_reveal实现了两个命令:RevealServerTag和RevealTag.

在服务器配置中,可以使用以下两个新命令:

<VirtualHost :9000>
DocumentRoot /home/camilla/WWW/docs
RevealTag H2Main
RevealServerTag H2
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

然后由模块处理.