2011-02-15 45 views
1

我的Ubuntu 10.04服務器虛擬機上運行的Apache 2(ESXi 4.1的),並獲得一些非常奇怪:上VM *阿帕奇2 *有時沒有找到啓用MODS的目錄

有時啓用MODS目錄中找到。
有時候不是。似乎沒有找到約75%。
兩者之間沒有任何變化。

下面是error.log中使用命令行合併證明這是怎麼回事一些摘錄:

於是我開始了停止Apache以使其更容易找到的東西在日誌中:

CMDLN: [email protected]:/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: [email protected]:/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: [email protected]:/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: [email protected]:/etc/apache2# cd .. 
CMDLIN: [email protected]:/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: [email protected]:/etc# apache restart 
APWARN: apache2: Syntax error on line 33 of /etc/apache2/apache2.conf: Include directory 'mods-enabled' not found 

仍然看起來像,但沒有日誌偏差T他的時間。改回apache目錄下,然後再次嘗試

CMDLIN: [email protected]:/etc# cd apache2/ 
CMDLIN: [email protected]:/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: [email protected]:/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: [email protected]:/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-由於某種原因相對於在我的shell中相對於I是...同時,在本身本來毛毛,它變得更糟時的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 [email protected] 
    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> 

一nd我的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 

我很難過。

任何想法這裏發生了什麼?

+0

經過一些更多的實驗後,我有一個總體想法是怎麼回事,但不知道爲什麼或如何解決它。看起來,如果我從/ etc/apache2(其中include目錄與'。'相關的目錄)啓動apache,它將失敗。當我發送一個SIGHUP(通過apache2ctl restart或通過kill -HUP到父進程)時,它也會失敗,但是當我在該目錄中啓動它時不會。我的猜測是chdir apache可能會對DocumentRoot造成HUP嘗試從/ var/www重新啓動。但是這仍然是不正確的。 – Dodger 2011-02-16 14:57:15

回答

0

apachectl是一個bash腳本。 您可能想要爲Ubuntu BTS提交該行爲的錯誤報告。

0

您應該刪除線在/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後修復它。

3

我在KVM虛擬客戶端上也遇到了完全相同的問題。 對我來說,解決辦法是取消對以下行:

#ServerRoot「的/ etc/apache2的」

希望這能幫助誰開始疑惑,爲什麼他要運行的下一個傢伙「apache2ctl開始」,在「/etc/apache2「目錄才能成功;)