Michael `s blog OSS / Linux, networking and my private life

26 Jan/09 1

Switching to lighttpd

Once I decided recently to switch to this web server from Apache to Lighttpd here a load graph from the date of NagiosGrapher can guess from the changeover fairly accurate:

Load Graph

As you can see has changed from 19.01. to 20.01. the load of the server changed slightly downwards! :)

All my sites now run by Lighttpd, I'm really excited about it.

24 Okt/08 3

Apache2 mpm-worker and fcgid

After Apache has felt the occasional times used on this site breaks thinking I've decided to replace the mpm-prefork mpm-worker with the version that is now also called by PHP FastCGI.

Below is a small configuration instructions.

  • Installing the required packages:

  aptitude install libapache2-mod-fcgid apache2-mpm-worker php5-cgi 

  • Configuration of the Apache

  a2dismod php5
 a2enmod actions
 a2enmod fcgid 

  • Customizing the Apache Configuration

/ Etc/apache2/mods-enabled/fcgid.conf

 AddHandler fcgid-script. Fcgi
 Socketpath / var/lib/apache2/fcgid/sock
 IPCConnectTimeout 60 

/ Etc/apache2/conf.d/php5-fcgid.conf

 # Path to php.ini - defaults to / etc / phpX / cgi
 DefaultInitEnv PHPRC = / etc/php5/cgi

 # Number of PHP childs that will be launched.  Leave undefined to let PHP decide.
 DefaultInitEnv PHP_FCGI_CHILDREN # 3

 # Maximum requests before a process is stopped and a new one is launched
 DefaultInitEnv PHP_FCGI_MAX_REQUESTS 2500

 # Define a new handler "php-fcgi" for. "Php" files, plus the action that must follow
 AddHandler php-fcgi. Php
 Action php-fcgi / fcgi-bin/php-fcgi-wrapper

 # Define the MIME type for. "Php" files
 AddType application / x-httpd-php. Php

 # Define alias "/ fcgi-bin /".  The action above is using this value, Which that means
 # You could run another "php5-cgi" command by just changing this alias
 Alias ​​/ fcgi-bin / / var/www/fcgi-bin.d/php5-default /

 # Turn on the fcgid-script handler for all files within the alias "/ fcgi-bin /"

 SetHandler fcgid-script
 Options + ExecCGI 

  • Creating the wrapper with

/ Var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper

  # / Bin / sh
 # Wrapper for PHP-fcgi
 # This wrapper can be used to define settings before launching the PHP-fcgi binary.

 # Define the path to php.ini.  This defaults to / etc / phpX / cgi.
 # Export PHPRC = / var/www/fcgi-bin.d/php5-web01/phprc
 export PHPRC = / etc/php5/cgi

 # Define the number of PHP childs that will be launched.  Leave undefined to let PHP decide.
 export PHP_FCGI_CHILDREN = 5

 # Maximum requests before a process is stopped and a new one is launched
 export PHP_FCGI_MAX_REQUESTS = 5000

 # Launch the PHP CGI binary
 # This can be any other version of PHP is compiled with FCGI Which support.
 exec / usr/bin/php5-cgi 

  • the new wrapper to make it executable

  chmod + x / var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper 

  • Finally, Apache must be restarted again

  / Etc/init.d/apache2 restart 

27 Mrz/07 0

Apache-SSL BasicAuth not working after upgrade Sarge

After upgrading the debian apache-ssl package from woody to sarge the Basic Authentication did not work anymore.

In my case the error was the SSLFakeBasicAuth setting in the httpd.conf.
Unsetting this directive fixed the problem

14 Mrz/07 0

Apache htaccess authentication and LDAP

if you would like to setup on two phase htaccess apache2 + ldap authentication this are the right settings:

AuthName "access" AuthType Basic AuthUserFile /etc/apache2/rt.htpasswd AuthLDAPAuthoritative On AuthAuthoritative Off AuthLDAPURL "ldap://host/OU=<name>,DC=<domain>,DC=com?samAccountName?sub?(objectCategory=person)(ObjectClass=User)" AuthLDAPBindDN <binduser> AuthLDAPBindPassword <bindpassword> order allow,deny allow from all require valid-user

The important settings are:

AuthLDAPAuthoritative On AuthAuthoritative Off

with his apache htaccess checks both the users and the LDAP