FreeBSD: Cannot load /usr/local/libexec/apache22/ into server: /usr/local/libexec/apache22/

Posted on in Categories , , , , , last updated September 18, 2008

Q. I’ve installed Apache2 and mod_security21 under FreeBSD. Whenever I try to restart apach22 process I get following error:

Cannot load /usr/local/libexec/apache22/ into server: /usr/local/libexec/apache22/

How do I fix this problem?

Apache Web Server Prevent Directory / Folder Listing

Posted on in Categories , , , , , , , last updated December 4, 2007

Q. If there is no index.html or index.php, Apache displays all other files in a Directory. How do I force Apache web server not to display my directory / folder list?

A.This controlled by a module called mod_autoindex or mod_dir.

You can completely remove (or replace) automatic index generation as per your requirements. The IndexIgnore directive adds to the list of files to hide when listing a directory. File is a shell-style wildcard expression or full filename. Multiple IndexIgnore directives add to the list, rather than the replacing the list of ignored files. By default, the list contains . (the current directory). Open your httpd.conf or .htaccess file and append following directive to block auto indexing for all pdf and mp3 files:
IndexIgnore *.pdf *.mp3
To enforce or deny complete folder listing, use *:
IndexIgnore *
Save and close the file. Restart httpd if httpd.conf was updated:
# service httpd restart

Further readings:

=> Apache mod_autoindex help pages.

Hide the Apache Web Server Version number with ServerSignature and ServerTokens directives

Posted on in Categories , , , , , , , , , , last updated September 15, 2007

Q. How do I hide the Apache version number under CentOS Linux 5 server?

A. You can easily hide Apche (httpd) version number and other information. There are two config directives that controls Apache version. The ServerSignature directive adds a line containing the Apache HTTP Server server version and the ServerName to any server-generated documents, such as error messages sent back to clients. ServerSignature is set to on by default. The ServerTokens directive controls whether Server response header field which is sent back to clients includes a description of the generic OS-type of the server as well as information about compiled-in modules. By setting this to Prod you only displays back Apache as server name and no version number displayed back.

Open your httpd.conf file using text editor such as vi:
vi httpd.conf

Append/modify config directive as follows:
ServerSignature Off
ServerTokens Prod

Save and close the file. Restart Apache web server:
# /etc/init.d/httpd restart