Debian

Apache2:無效命令“LockFile”

  • May 12, 2020

我的 Apache2 將無法工作,當我嘗試執行apache2 --version或任何其他 apache 命令時,它會出錯並顯示以下消息:

AH00526: Syntax error on line 89 of /etc/apache2/apache2.conf:
Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration

我的/etc/apache2/apache2.conf(沒有無休止的評論)如下所示:

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

<IfModule mpm_prefork_module>
   StartServers          5
   MinSpareServers       5
   MaxSpareServers      10
   MaxClients          150
   MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_worker_module>
   StartServers          2
   MinSpareThreads      25
   MaxSpareThreads      75
   ThreadLimit          64
   ThreadsPerChild      25
   MaxClients          150
   MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_event_module>
   StartServers          2
   MinSpareThreads      25
   MaxSpareThreads      75
   ThreadLimit          64
   ThreadsPerChild      25
   MaxClients          150
   MaxRequestsPerChild   0
</IfModule>

User ${APACHE_RUN_USER}                                                                                                               Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess

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

DefaultType None
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
Include mods-enabled/*.load
Include mods-enabled/*.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/
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

閱讀httpd 2.4 升級文件。在幾項更改中,刪除了LockFile指令:

指令 AcceptMutex、LockFile、RewriteLock、SSLMutex、SSLStaplingMutex 和 WatchdogMutexPath 已替換為單個Mutex指令。您將需要評估在 2.2 配置中對這些已刪除指令的任何使用,以確定它們是否可以被刪除或需要使用 Mutex 替換。

引用自:https://serverfault.com/questions/1016847