`apache2ctl restart`让Apache忘记了cgi-bin

在我的Debian机器上(运行由Debian打包的apache,包2.4.7-1),每次apache通过apache2ctl restartapache2ctl graceful apache2ctl restart ,它都会忘记我的cgi-bin目录:

 me@aram:~$ sudo apache2ctl graceful-stop me@aram:~$ sudo apache2ctl graceful httpd not running, trying to start me@aram:~$ curl -s http://localhost/cgi-bin/hello Hello world, from a cgi script. me@aram:~$ sudo apache2ctl graceful me@aram:~$ curl -s http://localhost/cgi-bin/hello <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /cgi-bin/hello was not found on this server.</p> <hr> <address>Apache/2.4.7 (Debian) Server at localhost Port 80</address> </body></html> me@aram:~$ sudo apache2ctl graceful me@aram:~$ curl -s http://localhost/cgi-bin/hello Hello world, from a cgi script. me@aram:~$ sudo apache2ctl graceful; sudo apache2ctl graceful me@aram:~$ curl -s http://localhost/cgi-bin/hello Hello world, from a cgi script. me@aram:~$ sudo apache2ctl graceful me@aram:~$ curl -s http://localhost/cgi-bin/hello <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /cgi-bin/hello was not found on this server.</p> <hr> <address>Apache/2.4.7 (Debian) Server at localhost Port 80</address> </body></html> me@aram:~$ sudo apache2ctl graceful me@aram:~$ curl -s http://localhost/cgi-bin/hello Hello world, from a cgi script. 

这是完全可重复的; 如果我完全停止服务器并重新启动它,那很好。 之后,重新启动(优雅与否)切换行为。 不幸的是,正常的logrotate作业logrotate了一个正常的重启,所以我需要让Apache总是知道cgi-bin

访问或错误日志中没有任何内容标记“将知道关于CGI”重启从“不知道CGI”重新启动。 如果有人build议如何使日志更加冗长,我会尝试并更新。

我正在使用Debian软件包的configuration(所以它是通过将-exabled目录中的一堆文件-enabled-enabled目录下的现有文件来configuration的)。 在这里,作为参考,是我的-enabled目录包含:

 me@aram:/etc/apache2$ ls *-enabled conf-enabled: 000-local-routerblock.conf charset.conf javascript-common.conf other-vhosts-access-log.conf serve-cgi-bin.conf apache2-doc.conf dwww.conf localized-error-pages.conf security.conf mods-enabled: access_compat.load authn_core.load authz_host.load cgi.load dir.load filter.load mpm_prefork.load reqtimeout.load status.load alias.conf authn_file.load authz_user.load deflate.conf dnssd.conf mime.conf negotiation.conf setenvif.conf userdir.conf alias.load authz_core.load autoindex.conf deflate.load dnssd.load mime.load negotiation.load setenvif.load userdir.load auth_basic.load authz_groupfile.load autoindex.load dir.conf env.load mpm_prefork.conf reqtimeout.conf status.conf sites-enabled: 000-default.conf 

除了000-local-routerblock.conf以外,所有这些都是由Debian提供的。 我已经validation,删除该configuration文件修复了这个问题,所以我怀疑这个文件和默认的serve-cgi-bin.conf文件之间有一些奇怪的交互。 但是,再次,日志中没有证据。

000-local-routerblock.conf

 Redirect /router /cgi-bin/router <Location "/cgi-bin/router"> AuthUserFile /usr/lib/cgi-bin/routerblock/htpasswd AuthGroupFile /dev/null AuthName ByPassword AuthType Basic Require user router </Location> 

serve-cgi-bin.conf

 <IfModule mod_alias.c> <IfModule mod_cgi.c> Define ENABLE_USR_LIB_CGI_BIN </IfModule> <IfModule mod_cgid.c> Define ENABLE_USR_LIB_CGI_BIN </IfModule> <IfDefine ENABLE_USR_LIB_CGI_BIN> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Require all granted </Directory> </IfDefine> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

编辑:我已经解决了这个问题,在“我做了工作”方面。 我不知道为什么这个工作,而且几乎可以肯定地表明在这个版本的Apache中的错误。 我将离开赏金,让人来回答什么是/正在发生什么。

无论如何,解决scheme不在任何configuration。 我引用的文件。 记住,这个configuration的其余部分完全是Debian的版本,没有关于configuration的自定义。 Debian /etc/apache2/apache2.conf包含以下行:

 LogLevel warn 

在库存configuration中,除了文件/etc/apache2/sites-available/000-default.conf的注释之外,没有其他LogLevel语句。 (整个文件在一个<VirtualHost *:80>标签内;它设置DocumentRoot和访问日志,但没有别的)

当我偶然发现LogLevel设置时,我在LogLevel设置中试图获取更多信息:如果我在VirtualHost标记中有一个LogLevel语句,它就可以工作。 所以现在除了主apacheconfiguration中的LogLevel warn ,我还在000-default.conf<VirtualHost *:80>标记内部有一个LogLevel warn 。 这工作。 如果我在这个周末有额外的时间,我想我会尝试设置一个虚拟机,在尽可能干净的环境中重现这个虚拟机,然后提交一个Debian的bug。

根据上面的错误报告的评论和链接,这似乎是最近已经解决的一个有效的错误; 来自https://bugs.debian.org/743860

来自:Jean-MichelVourgère
致:[email protected]
主题:Re:apache2:Apache在重启时忘记/ cgi-bin
date:2015年六月8日,星期一00:12:12 +0000

资料来源:apache2 Source-Version:2.4.10-1

你好

我们相信您报告的错误是固定的。

感谢您报告错误,现在将被closures。 如果您有进一步的意见,请将其发送至[email protected],如果适当,维护人员将重新打开错误报告。