VM *上的Apache 2有时*没有找到mods

我在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的东西...

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能够因为某种原因与我的位置相关,在我的身体里......而这种本身就会变得毛茸茸的,它变得更糟当Apache在运行过程中关闭它自己的同一个“错误”

这是我的httpd.conf:

<Location ~ "/ws/?.*$">
    SetHandler perl-script
    PerlResponseHandler Webservices::Qmedtrix
</Location>

<Directory /var/www>
    Options +ExecCGI +Includes
</Directory>

<Directory /usr/share>
    Options ExecCGI FollowSymlinks Indexes
</Directory>

ProxyPass /group http://localhost:8080/group
ProxyPassReverse /group http://localhost:8080/group

这是我的apache2.conf:

LockFile ${APACHE_LOCK_DIR}/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

StartServers          2
MinSpareThreads      25
MaxSpareThreads      75
ThreadLimit          64
ThreadsPerChild      25
MaxClients          150
MaxRequestsPerChild   0

User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

AccessFileName .htaccess

<Files ~ "^.ht">
    Order allow,deny
    Deny from all
    Satisfy all
</Files>

DefaultType text/plain
HostnameLookups On
ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

Include mods-enabled/*.load
Include mods-enabled/*.conf

Include httpd.conf
Include 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"" combined
LogFormat "%h %l %u %t "%r" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

Include conf.d/

Include sites-enabled/

这是我的默认虚拟域名:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DirectoryIndex index.shtml index.html

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews +Includes +ExecCGI
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined

</VirtualHost>

和我的envars文件:

#unset HOME
# I have tried the above line enabled and not, no difference.

if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
        SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
        SUFFIX=
fi

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
export LANG=C
export LANG

我很难过。

任何想法发生了什么?


我在KVM虚拟客户端也遇到了完全相同的问题。 对我来说,解决方案是取消注释以下行:

#ServerRoot“/ etc / apache2”

希望这可以帮助下一个开始想知道为什么他必须在“/ etc / apache2”目录中运行“apache2ctl start”才能成功的人;)


apachectl是一个bash脚本。 您可能需要将该行为的错误报告提交给Ubuntu BTS。


您应该删除/etc/envvars文件中的行:

#unset HOME
# I have tried the above line enabled and not, no difference.

if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
        SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
        SUFFIX=
fi

删除所有这些。

然后编辑你的envvars以删除你的$后缀,以便你的最终文件看起来像这样:

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2.pid
export APACHE_RUN_DIR=/var/run/apache2
export APACHE_LOCK_DIR=/var/lock/apache2
export APACHE_LOG_DIR=/var/log/apache2
export LANG=C
export LANG

我和你的问题完全一样。 并在玩envvars后修复它。

链接地址: http://www.djcxy.com/p/64201.html

上一篇: Apache 2 on VM *sometimes* not finding mods

下一篇: Error in including header file in .h file but not in .cpp