
Deny from all – This denies request from everybody to the root directory.This processes the “deny” first and “allow” next. Order deny,allow – This is the order in which the “Deny” and “Allow” directivites should be processed.Options None – Set this to None, which will not enable any optional extra features.Secure the root directory by setting the following in the nf Restrict access to root directory (Use Allow and Deny) # ps -ef | grep -i http | awk ''Īpache 3. # vi nfĪfter this, if you restart apache, and do ps -ef, you’ll see that the apache is running as “apache” (Except the 1st httpd process, which will always run as root). Modify the nf, and set User and Group appropriately. Useradd -d /usr/local/apache2/htdocs -g apache -s /bin/false apache For example: apache.Ĭreate apache group and user. It is good to run apache in its own non-privileged account. mod_so.c – For loading modules during start or restartīy default, apache might run as nobody or daemon.
if you specify url/test/, it goes to url/test/index.html
mod_dir.c – For trailing slash redirect on directory paths. mod_mime.c – For setting document MIME types. prefork.c – For MPM (Multi-Processing Module) module. mod_log_config.c – Log client request. mod_auth* – For various authentication modules. In this example, we have the following apache modules installed. Or, comment out the BrowserMatch in your nf, if you disable mod_setenvif.Īfter the installation, when you do httpd -l, you’ll see all installed modules. Solution: If you use ssl, don’t disable setenvif. Error: Syntax error on line 223 of /usr/local/apache2/conf/extra/nf: Invalid command ‘BrowserMatch’, perhaps misspelled or defined by a module not included in the server configuration. If you enable ssl, and disable mod_setenv, you’ll get the following error. version – Handling version information in config files using IfVersionĭisable all of the above modules as shown below when you do. alias – Mapping of requests to different filesystem parts. actions – Action triggering on requests. autoindex – Displays directory listing when no index.html file is present. i.e ~username in URL will get translated to a directory in the server userdir – Mapping of requests to user-specific directories. configure –help, you’ll see all available modules that you can disable/enable. If you are planning to install apache from source, you should disable the following modules. If you are a sysadmin, you should secure your Apache web server by following the 10 tips mentioned in this article.