apache2 configtest 失败,输出“未加载 MPM”。

apache2 configtest 失败,输出“未加载 MPM”。
root@tasnim:/home/tara# service apache2 restart
 * Restarting web server apache2                                         [fail] 
 * The apache2 configtest failed.

配置测试的输出是:

AH00534: apache2: Configuration error: No MPM loaded.
Action 'configtest' failed.

使用

sudo a2enmod mpm_prefork
service apache2 restart

我有:

root@tasnim:/home/tara# service apache2 restart
 * Restarting web server apache2                                  [fail] 
 * The apache2 configtest failed.

配置测试的输出是:

AH00526: Syntax error on line 156 of /etc/apache2/apache2.conf:
Invalid command 'Require', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.

然后我打开/etc/apache2/apache2.conf文件并得到:

//access here, or in any related virtual host.
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied //this is line 156
</Directory>

使用

 apt-cache policy apache2

我有:

root@tasnim:/home/tara# apt-cache policy apache2
apache2:
Installed: 2.4.7-1ubuntu4.4
Candidate: 2.4.7-1ubuntu4.4
Version table:
*** 2.4.7-1ubuntu4.4 0
    500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
    500 http://archive.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
    100 /var/lib/dpkg/status
 2.4.7-1ubuntu4 0
    500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

使用

 a2query -v

我有:

root@tasnim:/home/tara# a2query -v
2.4.7

答案1

我也遇到了同样的问题,例如:

Starting web server apache2 
* The apache2 configtest failed. 
Output of config test was: apache2: 
Syntax error on line 140 of /etc/apache2/apache2.conf: 
Syntax error on line 2 of /etc/apache2/mods-enabled/mpm_itk.load: 
Cannot load /usr/lib/apache2/modules/mpm_itk.so into server: 
/usr/lib/apache2/modules/mpm_itk.so: cannot open shared object file:
No such file or directory Action 'configtest' failed. 
The Apache error log may have more information.

我尝试了这个:apt-get install libapache2-mpm-itk所以我解决了我的问题,重新安装丢失的文件以便我可以恢复。

谢谢,我希望你们能够找到解决方案。

答案2

sudo a2enmod auth_basic authn_core authn_file authz_core authz_host authz_user access_compat

启用模块来启动服务器

取自这个答案经过AB关于 Unix 和 Linux SE 的这个问题

相关内容