默认的 apache.conf(ubuntu 服务器)包含以下块:
# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
# .... …Run Code Online (Sandbox Code Playgroud) 我在 Ubuntu 14.04 上运行 apache v2.4 并且有这种格式的容器/指令
<IfModule mpm_prefork_module>
# ...
</IfModule>
Run Code Online (Sandbox Code Playgroud)
但是,我经常以这种方式在 apache 官方文档和 stackexchange 站点中看到引用的模块:
<IfModule prefork.c>
# ...
</IfModule>
Run Code Online (Sandbox Code Playgroud)
我搜索了很多,包括这里- http://httpd.apache.org/docs/2.4/mod/core.html#ifmodule和我无法找到区别是什么,什么时候应该使用另一个?
来自 apache文档:ifmodule 指令
模块参数可以是模块标识符或模块在编译时的文件名。
例如,rewrite_module 是标识符,mod_rewrite.c 是文件名。
在.htaccess文件中看到这个很常见
<IfModule mod_rewrite.c>
# ....
</IfModule>
Run Code Online (Sandbox Code Playgroud)
我grep已经编辑了我的/etc/apache2目录并且“mod_rewrite.c”没有在任何地方定义。
在我的机器上,该文件/etc/apache2/mods-available/rewrite.load
包含:
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
Run Code Online (Sandbox Code Playgroud)
所以是mod_rewrite.c对Windows/其他文件的引用吗?在哪种情况下在 linux 机器上引用它会是不正确的语法?