禁用这些模块后,HTTPD服务器无法启动mod_include,mod_info,mod_autoindex和mod_userdir

时间:2017-02-01 06:57:49

标签: php apache httpd.conf rhel

根据这篇文章" 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

1 个答案:

答案 0 :(得分:2)

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

注意你说的话: &#34;我禁用了这些模块mod_imap,mod_include,mod_info,mod_userdir,mod_autoindex。&#34;

请注意您现在的错误: &#34; AH00526:/etc/httpd/conf.d/autoindex.conf第16行的语法错误:无效命令&#39; IndexOptions&#39;,可能拼写错误或由服务器配置中未包含的模块定义&# 34。

您只需删除Option&#34; IndexOptions&#34;,因为它取决于您已卸载的mod_autoindex

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