Sundar Sundar - 4 years ago 134
Apache Configuration Question

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

As per this article "4. Disable Unnecessary Modules"

Ref: http://www.tecmint.com/apache-security-tips/

It’s always good to minor the chances of being a victim of any web attack. So it’s recommended to disable all those modules that are not in use currently. I disabled these modules mod_imap, mod_include, mod_info, mod_userdir, mod_autoindex.

After that httpd server is no restarting. Can you please help me to findout the issue.

I didn't get any errors on error_log or access_log

I got this following response if try to restart

● 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: 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"

#
# 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>


The error I got in this line I don't know what went wrong
IndexOptions FancyIndexing HTMLTable VersionSort

Answer Source

You are answering your own question really:

Note what you said: " I disabled these modules mod_imap, mod_include, mod_info, mod_userdir, mod_autoindex."

And note the error you now have: "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".

You just have to remove the Option "IndexOptions", since it depends on mod_autoindex, which you have unloaded

When Apache complains about not knowing a directive or an option it means that either you misspelled it, or that the module that provides it is not being loaded.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download