精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
There are two basic types of operations in which the server will involve your module:涉及模块服务器操作有两种基本类型:
Each of these is broken down into further situations. Configuration, for example, involves server-wide directive handling, per-virtual host directives, and perdirectory directives. Request processing likewise involves up to nearly a dozen different stages of processing.
每一个都被分解为进一步的情况,配置,例如,包括服务器范围内的指令处理,每个虚拟主机的指令,和每目录指令。请求处理同样涉及近十几个不同阶段的处理。
Your module’s functions can tell what the situation is from two factors: which of your routines is being invoked, and the arguments being passed to it. 您的模块的功能可以告诉你两个因素:你的程序被调用,并已给它传递了参数。
The configuration callbacks are invoked whenever it’s appropriate – which may mean only when the server is being started up, or when it’s in the process of locating a particular file on disk in the processing of an actual Web request. 配置回调函数当时机合适时就被调用——只有当服务器被启动时,或者当它是在一个处理中,这个处理定位磁盘上的一个特定文件。
I’ve already listed the two different types of configuration environments: server and per-directory. Each of those, however, breaks down into still further situations. 我已经列出了两种不同类型的配置环境:服务器和个人目录。其中每个都要进一步分解情况。
When dealing with server-wide configuration (which your module will only do if you’ve explicitly indicated that you want it to), there are two subcategories to the environment being configured. Either it’s what’s called the global or default server environment, which applies to all virtual hosts and situations in which a virtual host isn’t involved, or it’s handling the configuration for a specific virtual host.
当服务器范围内的配置(如果你明确表明你只想要您的模块做的)处理,对环境进行配置分为两个子类别。要么是所谓的全球或默认的服务器环境,适用于所有虚拟主机和一个虚拟主机不涉及情况,或者是处理一个特定的虚拟主机的配置。
It’s quite possible that your configuration functions will be called multiple times, such as in the case of a server with more than one virtual host. 您的配置功能很有可能被调用多次,比如在一个服务器和多个虚拟主机的情况下。
Server configuraton hooks are only invoked during server startup; unlike the per-directory configuration process, there are no changes that are made to the server configuration once it’s up and running. Per-directory configuration can happen both during server-wide configuration and during the processing of a client request at run-time.
服务器配置服务器启动时只被调用,不同的是目录配置过程,是由服务器配置进行一次启动并运行。没有变化。每个目录配置既可以在服务器范围内的配置,并在运行时客户端请求的处理过程中发生的。
Note: None of your module configuration routines should ever make assumptions about what other callbacks have been made, or in what order. Each needs to be completely independent of all others. If your module needs to pass some sort of state information between the various callback routines, you need to use the module configuration record mechanism described in the next section.
注意:所有模块配置需要对已作出回调或顺序作出假设。每个需要完全独立于其他的。如果你的模块需要通过各种回调中的状态信息,您需要使用在下一节中描述的模块配置记录机制。
All occurrences of Apache directives are associated with a scope. In some cases, the scope is the entire server (such as the PidFile directive); in others, the scope applies to a particular directory on the filesystem. The normal condition is for the scope of a directory-oriented directive to include any sub- or sub-sub-directories as well, so if directive “Foo On”applies to “C:\htdocs\bar” it also applies to “C:\htdocs\bar\bletch” and “C:\htdocs\bar\frotz” as well.
所有Apache的指令都和显示器连在一起。在某些情况下,是整个服务器范围(比如PidFile指令);而在其他情况下,适用于文件系统中一个特定的目录范围。正常情况是一个导向目录的指令范围包括所有的子目录,,如果指令“Foo On”适用于“C:\htdocs\bar”,那就也适用于“C:\htdocs\bar\bletch”和“C:\htdocs\bar\frotz”。
This is called inheritance, and the inheritance rules are defined on a directive-by-directive basis by the owning module. Of course, it’s quite possible that the effect of the “Foo On” directive in a parent directory may be overridden by a “Foo Off” directive in a subordinate directory – which would then apply to all subdirectories of that until overridden again.
这就是所谓的继承,继承规则指令按指令的基础由所属的模块定义。当然,很可能在父目录中“Foo On”指令的作用可能被下级目录“Foo Off”指令覆盖——它在第二次覆盖之前,会适用于所有的子目录。
The set of environments (typically a directory tree) to which a directive applies is called its scope.
一套环境(通常是一个目录树)的指令调用被称为适用范围。