From ConShell
Jump to navigation Jump to search

Best Practices

Directives for production systems.

ServerTokens Prod
ServerSignature Off

Tuning for Performance

Here are some helpful links.


Some mod_rewrite examples.

These directives simply enable rewrite and setup logging

RewriteEngine On
RewriteLogLevel 2
RewriteLog "/var/log/apache2/rewrite_log"

This example redirects any requests for /nagios to the secure-side. It is useful to use this in a <VirtualHost *:80>

RewriteRule ^/nagios.* https://www.example.com/nagios3/ [L,R]

This example redirects any request to containing www.example.com Host: header to secure-side

RewriteCond %{HTTP_HOST} ^www.example.com
RewriteRule ^(.*)$ https://www.example.com$1 [L,R]

This example redirects request to a homepage (/) to another page -in this case mediawiki main page

RewriteRule   ^/$    http://www.example.com/wiki/index.php/Main_Page [L,R]

This example redirects non-secure requests for /admin to the secure-side

RewriteCond %{HTTPS} !on
RewriteCond ^/admin(.*) https://www.example.com/admin(.*) [L,R]

Converting to Nginx?? See this guide.