Apache webserver

# list loaded modules
/usr/sbin/apache2ctl -M

# list avaiable modules
apachectl -t -D DUMP_MODULES

# check config
apache2ctl -S

a2dismod status - disable module

apachectl -V

# enable default SSL site
a2ensite default-ssl

# disable default SSL site
a2dissite default-ssl

Enable mod_rewrite module
a2enmod rewrite
/etc/init.d/apache2 force-reload

# /etc/apache2/sites-available/default f
change"AllowOverride None" to "AllowOverride All"
or the directory in which you will use the mod_rewrite module

debug mod_rewrite rules (Apache vhost config)
RewriteLogLevel 8
RewriteLog /var/log/apache2/rewrite.log

redirect all requests to SSL
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

DirectoryIndex
DirectoryIndex index.php index.php4 index.php3 index.html index.htm index.shtml

apt-get install apache2-utils
ab -n 100 -c 10 http://www.google.com/ > ad.out

deny referrer
RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} ^http://.*example\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*bad-website\.com/ [NC]
RewriteRule ^(.*)$ – [F,L]

test

# echo "SetEnv REGISTER_GLOBALS 0" >> .htaccess

# if this not work disable global php.ini (if you have permisions for this)
#dep# sed -i 's|register_globals = ON|register globals = OFF|g' /etc/php5/apache2/php.ini

# enable mod_rewrite
a2enmod rewrite
service apache2 restart

# change AllowOverride in /etc/apache2/sites-available/default
from: AllowOverride None
to: AllowOverride All

# view php limit
php5 -i | grep memory_limit

apachectl
http://httpd.apache.org/docs/2.2/programs/apachectl.html
http://www.cyberciti.biz/faq/apache-2-reload-httpd-config-file-unix-linux-command/

Ldap authentification

AuthName "LDAP Authentification"
AuthType Basic
AuthBasicProvider ldap
AuthLDAPBindDN "foo@example.com"
AuthLDAPBindPassword bar
AuthLDAPURL "ldap://adproxy.example.com:3268/dc=example,dc=com?sAMAccountName?sub?(objectClass=*)" NONE
Order deny,allow
Satisfy any
Deny from all
require ldap-group CN=IPG.FooBar,OU=_IntranetPermissionGroups,DC=example,DC=com
# Allow from 192.168.1.10

includes
sed -i 's|AuthUserFile /etc/icinga/htpasswd.users|Include /etc/apache2/ldap.auth.conf|g' /etc/apache2/conf-available/icinga.conf

Docu
http://httpd.apache.org/docs/2.4/mod/core.html

Links
http://perishablepress.com/better-default-directory-views-with-htaccess/ - customize directory listing in apache
http://serverfault.com/questions/21106/how-to-reduce-memory-usage-on-a-unix-webserver - reduce memory usage by apache
http://httpd.apache.org/docs/2.0/vhosts/examples.html - VirtualHost Examples
http://www.cyberciti.biz/faq/howto-disable-apache-modules-under-linux-unix/