我在 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
它已经备份了。我很困惑。
我不知道为什么会发生这种情况,而且应该这样做是没有意义的。我的直觉告诉我,它以某种方式没有走上正确的道路,并且出于某种原因期望启用 mod 与我所在的位置相关当 Apache 在运行过程中因同样的“错误”而自行关闭时
这是我的 httpd.conf:
<位置 ~ "/ws/?.*$">
SetHandler perl 脚本
PerlResponseHandler Webservices::Qmedtrix
</位置>
<目录/var/www>
选项 +ExecCGI +包括
</目录>
<目录/usr/share>
选项 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
<文件 ~ "^\.ht">
命令允许,拒绝
拒绝一切
满足所有
</文件>
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/
包括启用站点/
这是我的默认虚拟域:
<虚拟主机 *:80>
ServerAdmin webmaster@localhost
DirectoryIndex index.shtml index.html
文档根目录 /var/www
<目录/>
选项 FollowSymLinks
AllowOverride 无
</目录>
<目录/var/www/>
选项索引 FollowSymLinks 多视图 +包括 +ExecCGI
AllowOverride 无
命令允许,拒绝
允许所有人
</目录>
错误日志 /var/log/apache2/error.log
# 可能的值包括:调试、信息、通知、警告、错误、暴击、
# 警报,出现。
日志级别警告
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
出口朗
我难住了。
有什么想法吗?