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

26Jan/091

Umstellung auf lighttpd

Nachdem ich mich vor kurzem dazu entschlossen habe diesen Webserver von Apache auf Lighttpd umzustellen hier ein Load-Graph aus dem NagiosGrapher der den Zeitpunkt der Umstellung relativ genau erahnen lässt:

Load Graph

Wie man sieht hat sich vom 19.01. bis zum 20.01. die Load des Servers geringfügig nach unten verändert ! :)

Alle meine Websites laufen mittlerweile mit Lighttpd, ich bin echt begeistert davon.

24Okt/084

Apache2 mpm-worker und fcgid

Nachdem gefühlt der Apache auf dieser Website gelegentlich mal denkpausen gebraucht hat habe ich mich dazu entschlossen die mpm-prefork mit der mpm-worker Version zu ersetzen, zusätzlich wird nun PHP durch FastCGI aufgerufen.

Anbei eine kleine Konfigurationsanleitung.

  • Installation der benötigten Pakete:

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

  • Konfiguration des Apache

a2dismod php5
a2enmod actions
a2enmod fcgid

  • Anpassen der Apache Konfigurationen

/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 means that
    # 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

  • Anlegen des Wrapper unter

/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 which is compiled with FCGI support.
exec /usr/bin/php5-cgi

  • den neuen Wrapper ausführbar machen

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

  • Schließlich muss der Apache noch neu gestartet werden

/etc/init.d/apache2 restart

27Mrz/070

Apache-SSL BasicAuth not working after Sarge upgrade

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

14Mrz/070

Apache LDAP and htaccess authentication

if you would like to setup an two phase apache2 htaccess+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 checks both the htaccess and the LDAP users