文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>apache配置文件之-Configuration Sections

apache配置文件之-Configuration Sections

时间:2006-07-11  来源:jingzhi

The <IfDefine> directive encloses directives that will only be applied if an appropriate parameter is defined on the httpd command line. For example, with the following configuration, all requests will be redirected to another site only if the server is started using httpd -DClosedForNow:

该标志支持嵌套定义,只在给定的变量在httpd命令行被定义时才有效。例如,下面的配置中,仅在服务器用httpd -d CloseForNow;命令启动时,所有的请求将被重定位到另外的站点。

<IfDefine ClosedForNow>
Redirect / http://otherserver.example.com/
</IfDefine>

The <IfModule> directive is very similar, except it encloses directives that will only be applied if a particular module is available in the server. The module must either be statically compiled in the server, or it must be dynamically compiled and its LoadModule line must be earlier in the configuration file. This directive should only be used if you need your configuration file to work whether or not certain modules are installed. It should not be used to enclose directives that you want to work all the time, because it can suppress useful error messages about missing modules.

<IfModule>标志也非常类似,只是他是在一个特定的module在服务器中有效时才被应用。这个module要么被静态编译到服务器中,要么被动态编译并且它的LoadModule行必须事前已经在配置文件中。该标志应该仅在你需要确认在你的配置文件中指定modules是否被安装时使用,而不应该用在服务器的运行时间里。因为他会禁止掉有用的关于丢失modules的错误信息。

In the following example, the MimeMagicFiles directive will be applied only if mod_mime_magic is available.

<IfModule mod_mime_magic.c>
MimeMagicFile conf/magic
</IfModule>

The <IfVersion> directive is very similar to <IfDefine> and <IfModule>, except it encloses directives that will only be applied if a particular version of the server is executing. This module is designed for the use in test suites and large networks which have to deal with different httpd versions and different configurations.

<IfVersion >= 2.1>
# this happens only in versions greater or
# equal 2.1.0.
</IfVersion>

<IfDefine>, <IfModule>, and the <IfVersion> can apply negative conditions by preceding their test with "!". Also, these sections can be nested to achieve more complex restrictions.

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载