![升级后的 Apache 服务器无法启动:/etc/apache2/apache2.conf 第 141 行语法错误](https://linux22.com/image/1203392/%E5%8D%87%E7%BA%A7%E5%90%8E%E7%9A%84%20Apache%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%EF%BC%9A%2Fetc%2Fapache2%2Fapache2.conf%20%E7%AC%AC%20141%20%E8%A1%8C%E8%AF%AD%E6%B3%95%E9%94%99%E8%AF%AF.png)
我将 Ubuntu 12 LTS 服务器升级到 Ubuntu 14 LTS,结果破坏了 apache2 设置(托管的子域不再起作用)。
Full Error: [so:warn] [pid 3782] AH01574: module security2_module is already loaded, skipping
apache2: Syntax error on line 141 of /etc/apache2/apache2.conf:
Syntax error on line 9 of /etc/apache2/mods-enabled/mod-
security.conf: No matches for the wildcard '*.conf' in '/etc/modsecurity',
failing (use IncludeOptional if required)
Action 'configtest' failed.
apache2.conf的Pastebin:https://pastebin.com/bG7PmmqP
mod-security.conf 的 Pastebin:https://pastebin.com/rNEF04Xx
/etc/modsecurity 只有 modsecurity.conf-recommended,当我升级到 Ubuntu 14 时,我认为它还有另一个文件;所以我想它正在尝试在那里找到一些东西但失败了。
我不确定哪里出了问题、发生了什么或者如何解决。
答案1
要解决该错误,似乎只需要在“/etc/modsecurity”目录中创建一些 *.conf 文件。将 modsecurity.conf-recommended 复制到 modsecurity.conf 可能是一个安全的选择。
仔细阅读 modsecurity.conf-recommended 文件,看看它是否符合你的需求,我已经好几年没用过 apache 了