禁用这些模块 mod_include、mod_info、mod_autoindex 和 mod_userdir 后 HTTPD 服务器未启动

HTTPD server not starting after disabling these modules mod_include, mod_info, mod_autoindex and mod_userdir

根据这篇文章“4. 禁用不必要的模块”

参考:http://www.tecmint.com/apache-security-tips/

减少成为任何网络攻击受害者的机会总是好的。因此,建议禁用所有当前未使用的模块。我禁用了这些模块 mod_imap、mod_include、mod_info、mod_userdir、mod_autoindex

在那之后httpd 服务器没有重新启动。你能帮我找出问题吗?

我在 error_log 或 access_log

上没有收到任何错误

如果尝试重新启动,我会收到以下响应

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2017-02-01 10:02:08 CET; 1min 15s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 58603 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 58601 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 58601 (code=exited, status=1/FAILURE)

apachectl configtest

"AH00526: /etc/httpd/conf.d/autoindex.conf 第 16 行的语法错误: 无效命令 'IndexOptions',可能拼写错误或由未包含在服务器配置中的模块定义

#
# Directives controlling the display of server-generated directory listings.
#
# Required modules: mod_authz_core, mod_authz_host,
#                   mod_autoindex, mod_alias
#
# To see the listing of a directory, the Options directive for the
# directory must include "Indexes", and the directory must not contain
# a file matching those listed in the DirectoryIndex directive.
#

#
# IndexOptions: Controls the appearance of server-generated directory
# listings.
#
IndexOptions FancyIndexing HTMLTable VersionSort

# We include the /icons/ alias for FancyIndexed directory listings.  If
# you do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/usr/share/httpd/icons/"

<Directory "/usr/share/httpd/icons">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride None
    Require all granted
</Directory>

我在这一行中得到的错误我不知道哪里出了问题IndexOptions FancyIndexing HTMLTable VersionSort

你真的是在回答你自己的问题:

注意你说的: “我禁用了这些模块 mod_imap、mod_include、mod_info、mod_userdir、mod_autoindex。”

并注意您现在遇到的错误: "AH00526: Syntax error on line 16 of /etc/httpd/conf.d/autoindex.conf: Invalid command 'IndexOptions', perhaps misspelled or defined by a module not included in the server configuration".

您只需删除选项 "IndexOptions",因为它依赖于您已卸载的 mod_autoindex

当 Apache 抱怨不知道指令或选项时,这意味着您拼错了它,或者提供它的模块没有被加载。