对 rewritemap 文件进行任何更改是否需要重新启动 apache 服务?

发布于 2024-09-29 01:54:37 字数 102 浏览 0 评论 0原文

我在 RewriteMap 指令中使用 perl 脚本文件作为映射文件。 当我读到apache在开始时加载脚本一次时,那么在对该脚本文件进行任何更改后是否需要重新加载或重新启动apache?

I am using a perl script file as a map file in RewriteMap directive.
As i read the apache load the script once at the beginning, So is it needed to reload or restart apache after any changes to this script file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心凉 2024-10-06 01:54:37

是的,重写映射仅在 Apache 启动时注册。当使用外部程序作为重写映射(即映射类型 pgr)时,需要使用 RewriteLock

该指令设置 mod_rewrite 需要与 RewriteMap 程序通信的同步锁定文件的文件名。当您想要使用重写映射程序时,请将此锁定文件设置为本地路径(不在安装 NFS 的设备上)。其他类型的重写映射不需要它。

但其他地图类型可以在之后更改:

对于纯文本和 DBM 格式文件,查找到的键会缓存在核心中,直到映射文件的mtime发生变化或服务器重新启动。这样,您就可以在用于每个请求的规则中拥有地图功能。这没问题,因为外部查找只发生一次!

Yes, rewrite maps are only registered when Apache is starting. And when using external programs as rewrite maps (i.e. map type pgr) the program files need to be locked with RewriteLock:

This directive sets the filename for a synchronization lockfile which mod_rewrite needs to communicate with RewriteMap programs. Set this lockfile to a local path (not on a NFS-mounted device) when you want to use a rewriting map-program. It is not required for other types of rewriting maps.

But the other map types can be changed afterwards:

For plain text and DBM format files the looked-up keys are cached in-core until the mtime of the mapfile changes or the server does a restart. This way you can have map-functions in rules which are used for every request. This is no problem, because the external lookup only happens once!

撧情箌佬 2024-10-06 01:54:37

我不确定上面的回复是否正确,重新加载似乎没问题。

您可以执行“ps aux | grep YOUR_REWRITE_PROGRAM”来检查重写映射程序的PID/开始时间。

Apache 重新加载似乎为这些进程设置了新的 PID/启动时间,所​​以我假设新进程已经启动,重新加载可能没问题。

I'm not sure if the response above is correct, reload seems to be fine.

You can do "ps aux | grep YOUR_REWRITE_PROGRAM" to check the PID/start time of your rewrite map program.

Apache reload seems to set a new PID/start time for these processes, so I would assume new processes have started, a reload may be fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文