当添加到工作,不然重写/ RewriteMap指令RewriteLock挂起的Apache重新启动 [英] RewriteLock hangs Apache on re-start when added to an otherwise working Rewrite / Rewritemap

查看:233
本文介绍了当添加到工作,不然重写/ RewriteMap指令RewriteLock挂起的Apache重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网络解决方案的VPS,四域名对应的IP。我有一个重写/ RewriteMap指令设立的作品。该重写是无功/网络/虚拟主机/ example.com / conf目录/ vhost.conf,重写是在vhost.conf文件中的唯一文件为example.com网址英寸它不会在服务器的主httpd.conf文件的工作。

I am on a Network Solutions VPS, four domain names share the IP. I have a Rewrite / RewriteMap set up that works. The Rewrite is in the file for the example.com web address at var/www/vhosts/example.com/conf/vhost.conf, the Rewrite being the only thing in the vhost.conf file. It would not work in the main httpd.conf file for the server.

该RewriteMap指令使用了两件事情由用户键入的URL(http://example.com/bb/cc)获得第三件从匹配的数据库记录信息(AA)的,使用了第三件作为查询字符串信息的加载文件,并保留原来录入的URL地址栏同时显示基于查询字符串AA文件。

The RewriteMap uses a couple things in the URL typed in by the user (http://example.com/bb/cc) to get a third piece of info (aa) from the matching database record, uses that third piece of info as the query string to load a file, and leaves the originally typed in URL in the address bar while showing the file based on the query string aa.

下面是重写:

Options +FollowSymlinks
RewriteEngine on
RewriteMap newurl "prg://var/www/cgi-bin/examplemap.php"
RewriteRule ^/(Example/.*) ${newurl:$1} [L]

当我添加以下任RewriteMap指令线之上或之下:

When I add the following either above or below the RewriteMap line:

RewriteLock /var/lock/mapexamplelock

和尝试重新启动Apache,它挂起和Apache不会重新启动。我曾尝试不同的文件路径(想这可能是一个权限问题,只是希望它的工作当然),带走了初步/,将它放在引号中,不同的文件类型(即.TXT结尾),不同的文件名,公正的东西,每次它挂在Apache的重新启动时间。该重写/ RewriteMap指令工作没有它,但我已经读了RewriteLock的重要性很多,而且PHP是发出日志中警告危险结尾不使用RewriteLock。

and try to re-start Apache, it hangs and Apache will not re-start. I have tried different file paths (thinking it might be a permissions issue and just hoping it worked of course), taking away the initial /, putting it in quotes, different file types (ie. .txt at the end), different file names, just about anything, and every time it hangs Apache on re-start. The Rewrite / RewriteMap works without it, but I have read a lot on the importance of the RewriteLock, and php is issuing warnings in the log ending in DANGEROUS not to use RewriteLock.

下面是地图(位于那里的改写说):

Here is the map (located where the Rewrite says):

#!/usr/bin/php
<?php
include '/pathtodatabase';
set_time_limit(0);
$keyboard = fopen("php://stdin","r");
while (1) {
$line = fgets($keyboard);
if (preg_match('/(.*)\/(.*)/', $line, $igot)) {
$getalias = mysql_query("select aa FROM `table`.`dbase` WHERE bb = '$igot[1]' && cc =     '$igot[2]'");
while($row=mysql_fetch_array($getalias)) {
$arid = $row['aa'];
}
print "/file-to-take-load.php?aa=$arid\n";
}
else {
print "$line\n";
}
}
?>

我看着在主httpd.conf文件并没有什么我可以找到RewriteLock可能被干扰。它只是排在VPS的设定了标准之一。

I looked in the main httpd.conf file and there is nothing I can find about RewriteLock that might be interfering. It's just the standard one that came in the set-up of the VPS.

如果有人知道为什么这只会工作不会RewriteLock和可能的修复一个想法,那将是极大的AP preciated。

If anyone has an idea about why this would work only without RewriteLock and the possible fix, it would be greatly appreciated.

由于格雷格

推荐答案

阿帕奇挂起,如果你定义多个RewriteLock指令,或者如果您在VHOST配置使用它。



该RewriteLock应在服务器配置级别只有一次指定。此锁定文件将被所有PRG类型的地图中使用。所以,如果你要使用多个PRG地图,我建议使用内部锁定机制,例如在PHP有羊群功能,并简单地忽略警告阿帕奇在错误日志中写道。



在这里看到更多的信息:

<一href=\"http://books.google.com/books?id=HUpTYMf8-aEC&lpg=PP1&pg=PA298#v=onepage&q&f=false\" rel=\"nofollow\">http://books.google.com/books?id=HUpTYMf8-aEC&lpg=PP1&pg=PA298#v=onepage&q&f=false

Apache hangs if you define more than one RewriteLock directives or if you use it in a VHOST config.

The RewriteLock should be specified at server config level and ONLY ONCE. This lock file will be used by all prg type maps. So if you want to use multiple prg maps, I suggest using an internal locking mechanism, for example in PHP there is the flock function, and simply ignore the warning apache writes in the error log.

See here for more info:
http://books.google.com/books?id=HUpTYMf8-aEC&lpg=PP1&pg=PA298#v=onepage&q&f=false

这篇关于当添加到工作,不然重写/ RewriteMap指令RewriteLock挂起的Apache重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆