【发布时间】:2011-06-27 21:44:12
【问题描述】:
我在 Ubuntu 10.04 服务器虚拟机 (ESXi 4.1) 上运行 Apache 2 并且得到了一些非常奇怪的东西:
有时会找到启用 mods 的目录。
有时不是。似乎没有大约 75% 没有找到。
两者之间没有任何改变。
以下是 error.log 中的一些摘录,结合命令行来演示发生了什么:
所以我首先停止 Apache,以便更容易地在日志中查找内容:
CMDLN: root@bunny:/etc/apache2# apache stop
APWARN: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
ERRLOG: [Tue Feb 15 11:45:40 2011] [notice] caught SIGTERM, shutting down
那我开始吧:
CMDLIN: root@bunny:/etc/apache2# apache start
APWARN: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
ERRLOG: [Tue Feb 15 11:46:09 2011] [notice] Apache/2.2.14 (Ubuntu) proxy_html/3.0.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
然后我重新启动它:
CMDLIN: root@bunny:/etc/apache2# apache restart
APWARN: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
ERRLOG: [Tue Feb 15 11:46:15 2011] [notice] SIGHUP received. Attempting to restart
然后我将目录改回一个以测试它使用我的 shell 路径的理论
CMDLIN: root@bunny:/etc/apache2# cd ..
CMDLIN: root@bunny:/etc# apache restart
APWARN: apache2: Syntax error on line 33 of /etc/apache2/apache2.conf: Include directory 'mods-enabled' not found
ERRLOG: apache2: Syntax error on line 33 of /etc/apache2/apache2.conf: Include directory 'mods-enabled' not found
目前看来……有点……
CMDLIN: root@bunny:/etc# apache restart
APWARN: apache2: Syntax error on line 33 of /etc/apache2/apache2.conf: Include directory 'mods-enabled' not found
看起来还是这样,但这次没有日志错误。换回apache目录再试一次
CMDLIN: root@bunny:/etc# cd apache2/
CMDLIN: root@bunny:/etc/apache2# apache restart
APWARN: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
APWARN: httpd not running, trying to start
ERRLOG: [Tue Feb 15 11:46:30 2011] [warn] pid file /var/run/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
ERRLOG: [Tue Feb 15 11:46:30 2011] [notice] Apache/2.2.14 (Ubuntu) proxy_html/3.0.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
嗯,看起来就是这样,对吧?至于为什么……不知道……
除了那个 DNS 之外,另一个 OK 重启...
CMDLIN: root@bunny:/etc/apache2# apache restart
APWARN: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
ERRLOG: [Tue Feb 15 11:46:36 2011] [notice] SIGHUP received. Attempting to restart
到目前为止一切顺利...等等...哎呀,这显示在日志中,而我没有更改目录,而 Apache 正在尝试启动,但却关闭了。
ERRLOG: apache2: Syntax error on line 33 of /etc/apache2/apache2.conf: Include directory 'mods-enabled' not found
我去重启它然后...
CMDLIN: root@bunny:/etc/apache2# apache restart
APWARN: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
APWARN: httpd not running, trying to start
ERRLOG: [Tue Feb 15 11:46:45 2011] [warn] pid file /var/run/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
ERRLOG: [Tue Feb 15 11:46:45 2011] [notice] Apache/2.2.14 (Ubuntu) proxy_html/3.0.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
而且它已经备份了。我很困惑。
我不知道为什么会这样,而且应该这样做是没有意义的。我的直觉告诉我,它不知何故没有走上正确的道路,并且出于某种原因期望启用 mods 与 I 在我的 shell 中的位置相关……而这本身就会一直毛茸茸的,当 Apache 因同样的“错误”而在运行过程中自行关闭时,情况变得更糟
这是我的 httpd.conf:
SetHandler perl 脚本 PerlResponseHandler Webservices::Qmedtrix 位置> 选项 +ExecCGI +包括 目录> 选项 ExecCGI FollowSymlinks 索引 目录> ProxyPass /group http://localhost:8080/group ProxyPassReverse /group http://localhost:8080/group这是我的 apache2.conf:
锁定文件 ${APACHE_LOCK_DIR}/accept.lock PidFile ${APACHE_PID_FILE} 超时 300 保持活动状态 MaxKeepAliveRequests 100 保持活动超时 15 启动服务器 2 MinSpareThreads 25 最大备用线程数 75 线程限制 64 每个孩子的线程数 25 最大客户数 150 MaxRequestsPerChild 0 用户 ${APACHE_RUN_USER} 组 ${APACHE_RUN_GROUP} 访问文件名 .htaccess 命令允许,拒绝 拒绝一切 满足所有 文件> DefaultType 文本/纯文本 主机名查找开启 错误日志 ${APACHE_LOG_DIR}/error.log 日志级别警告 包括 mods-enabled/*.load 包括 mods-enabled/*.conf 包括 httpd.conf 包括 ports.conf LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" 组合 LogFormat "%h %l %u %t \"%r\" %>s %O" 常见 LogFormat "%{Referer}i -> %U" 引用 LogFormat "%{User-agent}i" 代理 包括 conf.d/ 包括启用站点/这是我的默认虚拟域:
ServerAdmin webmaster@localhost DirectoryIndex index.shtml index.html 文档根目录 /var/www 选项 FollowSymLinks AllowOverride 无 目录> 选项索引 FollowSymLinks 多视图 +包括 +ExecCGI AllowOverride 无 命令允许,拒绝 允许所有人 目录> 错误日志 /var/log/apache2/error.log # 可能的值包括:debug、info、notice、warn、error、crit、 # 警报,出现。 日志级别警告 CustomLog /var/log/apache2/access.log 结合 虚拟主机>还有我的 envars 文件:
#取消设置主页 # 我试过上面的行启用了,没有,没有区别。 如果 [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ;然后 后缀="-${APACHE_CONFDIR##/etc/apache2-}" 别的 后缀= 菲 导出 APACHE_RUN_USER=www-数据 导出 APACHE_RUN_GROUP=www-data 导出 APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid 导出 APACHE_RUN_DIR=/var/run/apache2$SUFFIX 导出 APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX 导出 APACHE_LOG_DIR=/var/log/apache2$SUFFIX 导出 LANG=C 出口朗我被难住了。
有什么想法吗?
【问题讨论】:
-
经过更多实验后,我大致了解发生了什么,但不知道为什么或如何解决它。看来,如果我从 /etc/apache2 以外的任何目录(其中包含目录相对于'.')启动 apache,它就会失败。每当我发送 SIGHUP (通过 apache2ctl restart 或通过 kill -HUP 到父进程)时,它也会失败,但当我在该目录中启动它时不会失败。我的猜测是 chdir apache 可能会对 DocumentRoot 造成 HUP 尝试从 /var/www 重新启动。但这仍然不对。
-
我也有这种行为。只是让你知道你并不孤单:)
标签: ubuntu apache2 virtual-machine mod-perl2 esxi