Howto: nginx, php-fpm and serendipity weblog (s9y) with apache style rewriting

Nginx is (spoken: engine x) is a HTTP and reverse proxy server written by the russian developer Igor Sysoev. Nginx is also able to proxy mail server requests coming in via pop3 and imap.
Popular sites like FastMail.FM and WordPress.com are usually using nginx as reverse proxy or HTTP Server.
According to Netcrafts Web Server Survey from December 2009 nginx gained 5,2% market share since December 2008 and will exceed the 7% barrier in january 2010. In addition to that 12,9 million websites started using nginx as webserver or loadbalancer as first contact instance in the year 2010. Nginx now clearly exceeds the former lightwight webserver king lighttpd (market share round 0.36% in December 2009).

In a first example we use nginx is together with the FastCGI Process Manager php-fpm in order to run a serendipity weblog.
PHP-fpm will be included in future versions of PHP 5.3 but isn’t shipped with stable PHP 5.2 and therefore we have to built php and php-fpm the traditional way.

Continue reading

Related Posts:

Installing Icinga 1.0 with IDOUtils and NConf

Today the icinga team released the first stable version of their open source monitoring tool – Icinga 1.0.
The team behind icinga formed up earlier this year and forked nagios due to several reasons.
In this small howto i’d like to describe the installation of Icinga in cooperation with IDOUtils and NConf for easier configuration of multiple hosts and services on a fresh debian system:

  1. Install some prequisites:

    apt-get install apache2 build-essential libgd2-xpm-dev libjpeg62 libjpeg62-dev libpng12 libpng12-dev mysql-server mysql-client libdbi0 libdbi0-dev libdbd-mysql libdbi-perl libdbd-mysql-perl

  2. As root, add an user and group for icinga:

    /usr/sbin/useradd -m icinga && /usr/sbin/groupadd icinga

  3. Download icinga-core 1.0 (not icinga-web) from the icinga download site
  4. Unpack the downloaded archive, for example in a new directory called /usr/local/icinga with the command

    tar xzfv icinga-1.0.tar.gz

  5. Enter the new directory and configure icinga with
    ./configure –enable-idoutils

  6. General options should look like this:

    General Options:
    ————————-
    Icinga executable: icinga
    Icinga user/group: icinga,icinga
    Command user/group: icinga,icinga
    Embedded Perl: no
    Event Broker: yes
    Build IDOUtils: yes
    Install ${prefix}: /usr/local/icinga
    Lock file: ${prefix}/var/icinga.lock
    Check result directory: ${prefix}/var/spool/checkresults
    Init directory: /etc/init.d
    Apache conf.d directory: /etc/apache2/conf.d
    Mail program: /usr/bin/mail
    Host OS: linux-gnu

  7. Compile the icinga source code with

    make all

  8. If everything went fine, just install icinga completely with

    make fullinstall

  9. Time for some customization:
    comment out all cfg_file options from line 30 to line 36 of icinga.cfg, they´ll be provided by NConf later:

    # You can specify individual object config files as shown below:

    #cfg_file=/usr/local/icinga/etc/objects/commands.cfg
    #cfg_file=/usr/local/icinga/etc/objects/contacts.cfg
    #cfg_file=/usr/local/icinga/etc/objects/timeperiods.cfg
    #cfg_file=/usr/local/icinga/etc/objects/templates.cfg

    # Definitions for monitoring the local (Linux) host
    #cfg_file=/usr/local/icinga/etc/objects/localhost.cfg

    # Definitions for monitoring a Windows machine
    #cfg_file=/usr/local/icinga/etc/objects/windows.cfg

    # Definitions for monitoring a router/switch
    #cfg_file=/usr/local/icinga/etc/objects/switch.cfg

    # Definitions for monitoring a network printer
    #cfg_file=/usr/local/icinga/etc/objects/printer.cfg

  10. Add two new cfg_dir options for NConf:

    cfg_dir=/usr/local/icinga/etc/objects/global
    cfg_dir=/usr/local/icinga/etc/objects/Default_collector/

  11. uncomment broker_module in line 251:

    broker_module=/usr/local/icinga/bin/idomod.o config_file=/usr/local/icinga/etc/idomod.cfg

  12. In /usr/local/icinga/etc directrory, create IDOUtils sampe configuration:

    cp idomod.cfg-sample idomod.cfg
    cp ido2db.cfg-sample ido2db.cfg

  13. Generate MySQL Database and User for icinga

    # mysql -u root -p
    mysql> CREATE DATABASE icinga;
    GRANT USAGE ON \*.\* TO ‘icinga’@'localhost’ IDENTIFIED BY ‘MYSUPERHEROPASSWORD’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;

    GRANT ALL PRIVILEGES ON icinga.\* TO ‘icinga’@'localhost’;FLUSH PRIVILEGES ;
    quit

  14. Import corresponding database scheme for MySQL:

    # cd /path/to/icinga-src/module/idoutils/db
    # mysql -u root -p icinga < mysql.sql

  15. Customize database credentials in /usr/local/icinga/etc/ido2db.cfg
    and take care of the following options:

    db_servertype=mysql
    db_port=3306
    db_user=icinga
    db_pass=MYSUPERHEROPASSWORD

  16. Change .htaccess password for the icingaadmin: htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin
  17. Copy sample configuration for apache:

    cp /usr/local/icinga/icinga-1.0/sample-config/httpd.conf /etc/apache2/conf.d/icinga.conf

  18. Download latest NConf release from the NConf download page
  19. Unpack the archive in one of your web directories, e.g. in /var/www/nconf

    tar xzfv nconf-1.2.6-0.tgz

  20. Make the new directory read/writeable to your webserver:

    chown -R www-data:www-data nconf/

  21. Create new file nconf.conf in /etc/apache2/conf.d:

    #nconf.conf
    Alias /nconf "/var/www/virtual/nconf"

    # SSLRequireSSL
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
    # Order deny,allow
    # Deny from all
    # Allow from 127.0.0.1
    AuthName "Icinga Access"
    AuthType Basic
    AuthUserFile /usr/local/icinga/etc/htpasswd.users
    Require valid-user

  22. Reload apache
  23. /etc/init.d/apache2 reload

  24. Create database and user for NConf:

    # mysql -u root -p
    mysql> CREATE DATABASE nconf;
    GRANT USAGE ON \*.\* TO ‘nconf’@'localhost’ IDENTIFIED BY ‘MYSUPERHEROPASSWORD’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
    GRANT ALL PRIVILEGES ON nconf.\* TO ‘nconf’@'localhost’;
    FLUSH PRIVILEGES ;
    quit

  25. Complete installation via NConf Web Gui, for example on
  26. Put /usr/local/icinga/bin/icinga as NAGIOS_BIN
  27. Configure your hosts and services in the NConf WebGui
  28. make sure to delete the host and service notification state "[n]" editing your contacts, otherwise you won’t get any notification.
  29. Edit the notify-host-by-email/notify-sercice-by-email command in misccommands section in order to point to the corresponding binary for the mail command, in my case /usr/bin/mail
  30. After finishing host and services configuration, hit the Generate Nagios config Button.
  31. Your nagios configuration is now saved in the /output directory of your NConf installation.
  32. customize NConf deploy script in /var/www/virtualnconf/ADD-ONS/deploy_local.sh, for example:

    #!/bin/bash

    OUTPUT_DIR="/var/www/virtual/nconf/output/"
    NAGIOS_DIR="/usr/local/icinga/etc/objects/"
    TEMP_DIR=${NAGIOS_DIR}"import/"
    CONF_ARCHIVE="NagiosConfig.tgz"

    if [ ! -e ${TEMP_DIR} ] ; then
    mkdir -p ${TEMP_DIR}
    fi

    if [ ${OUTPUT_DIR}${CONF_ARCHIVE} -nt ${TEMP_DIR}${CONF_ARCHIVE} ] ; then
    cp -p ${OUTPUT_DIR}${CONF_ARCHIVE} ${TEMP_DIR}${CONF_ARCHIVE}
    tar -xf ${TEMP_DIR}${CONF_ARCHIVE} -C ${NAGIOS_DIR}
    /etc/init.d/icinga reload
    fi

    exit

  33. Configure cronjob to refresh your configuration regulary, if you want to

    */10 * * * * /var/www/virtual/nconf/ADD-ONS/deploy_local.sh

  34. Start IDOUtils:

    /etc/init.d/ido2db start

  35. Start Icinga:

    /etc/init.d/icinga start

  36. Check icinga.log logfile in /usr/local/icinga/var
  37. Be Happy!
    1. For more information on Icinga and IDOUtils check out the documentation.
      More information on NConf is available in the NConf documentation.

Related Posts:

Aktuelle Projekte

diginights.com

Diginights.com ist das größte Event- und Nightlifeportal in Heilbronn und Umgebung, welches seit geraumer Zeit auch überregional tätig ist. So gibts neben der Region Heilbronn mittlerweile auch Bereiche für Stuttgart, Ludwigsburg, Mosbach, den Hohenlohekreis, Mannheim und Heidelberg.
Diginights begann für mich im Jahre 2003 als Freizeitprojekt und ist mittlerweile erwachsen geworden. Seitdem unterstütze ich bei der Administration, Planung und Weiterentwicklung des facettenreichen Online Portals. Ein paar Statistiken zum Thema Visits, Bilder & co. finden sich auf dieser Seite.
Diginights.com läuft im Rechenzentrum von Hetzner Online und basiert auf dem PHP Framework Symfony und dem Forensystem Burning Board 3 von Woltlab. Außerdem setzen wir auf den AdServer OpenX, das SCM & Project Management Tool Trac und das Versionskontrollsystem Subversion.

glamour-village.de

Glamour-Village.de ist eine Online Shoppingplattform mit dem Focus auf Markenartikeln aus den Bereichen Mode, Schmuck und Accessoires. Die waren werden zum Teil zu Preisen mit 70-80% unter Marktpreis angeboten. Man kann also das eine oder andere Schnäppchen ergattern!
Bei Glamour-Village.de kümmere ich mich ebenfalls um die Administration und unterstütze ein wenig bei Kommunikationsthemen. Ist ein spannendes Thema und man sieht, dass gesundes Wachstum auch ohne Venture Capital Finanzierung möglich ist.
Glamour-Village.de läuft ebenfalls auf Servern bei Hetzner Online unter Verwendung des PHP Frameworks Symfony , des Loadbalancers HAProxy und des russischen Webservers NGINX.

Related Posts:

Probleme bei Dovecot Migration mit Sieve Plugin

Nach Installation der neusten Dovecot Version (1.2.4-2 via debian-testing) kommt es bei Verwendung des alten CMUSieve Plugins zu folgendem Problem im Mail.log:

Fatal: Plugin cmusieve not found from directory /usr/lib/dovecot/modules/lda

Nachrichten werden dann nicht mehr zugestellt.

Warum tuts auf einmal nicht mehr? CMUSieve ist eigentlich deprecated und man möchte das für Dovecot 1.2 geschriebene Dovecot Sieve plugin verwende.
Dazu muss man folgenden Eintrag ändern.

protocol lda {
mail_plugin_dir = /usr/lib/dovecot/modules/lda
mail_plugins = sieve
sieve_extensions = +imapflags
log_path = /var/log/dovecot/deliver.log
info_log_path = /var/log/dovecot/deliver-info.log

In der “mail_plugins” Zeile ersetzt man also einfach “cmusieve” durch “sieve”.
Folgende Änderungen muss man noch beachten:

# The imapflags extension is now called imap4flags. The CMUSieve implementation is based on an old draft specification that is not completely compatible. Particularly, the mark and unmark commands were removed from the new specification. For backwards compatibility, support for the old imapflags extension can be enabled using the sieve_extensions setting (as explained above). This is disabled by default.

# The notify extension is now called enotify. Sieve scripts need to be adjusted to incorporate this change: unlike imapflags, no backwards compatibility is provided currently.

Hier muss man also noch ein wenig aufpassen und ggf. seine Sieve Tools, wie beispielsweise den pysieved auf die aktuellste Version aktualisieren.

Related Posts:

UMTS Stick von Vodafone ohne Simlock

Als Initiator der Aktion , dank dessen der Martin nun aufgrund der horrenden Umsatzbeteiligungen von Amazon bald nach Down Under fliegt, verliere ich nun endlich auch mal ein paar Worte über das gute Stück.

Einen USB UMTS Stick wollte ich schon lange mein eigenen nennen, damit ich mit meinem NC10 auch vernünftig unterwegs online gehen kann. Bisher waren mir die Teile aber einfach zu teuer. Eines Tages stolperte ich über eine Vodafone Werbung “Vodafone Webstick UMTS/USB für 29€”. Also hab ich mir das Teil bestellt, und zwar direkt auf der Seite von Vodafone.

Nun hat ich endlich mal Zeit, das Ding auszuprobieren. Leider funktioniert die Installation nicht ganz so reibungslos, denn ich hatte nicht den ursprünglich vertriebenen Stick, sondern einen K-3565-Z bekommen, der so ohne weiteres nicht unter Ubuntu funktioniert.
Der Stick ist zwar nun HSDPA fähig, allerdings erkennt Ubuntu nur das SD Storage und ignoriert das Modem selbst.
Erkennen kann man das Gerät mit folgender vendor & product ID mittels lsusb:

andy@andy-nc10:~$ lsusb
Bus 001 Device 006: ID 19d2:0063

Nach ein wenig googlen stieß ich auf eine etwas umständlichere Lösung meines Problems auf dieser Seite. Nach ein bisserl modules gefrickel und usb_modeswitch Versuchen installierte ich die verlinkten Vodafone Treiber von Betavine. Und siehe da, nach Installation von aktuellem usb_modeswitch & vodafone-mobile-connect und aktuellem Ubtunu 9.04 Kernel (2.6.28-15-generic) wird der Stick nun auch ohne usb_modeswitch erkannt.

Wer also auf der Suche nach einem günstigen USB Umts Stick ist, welcher zu allen Providern (kein unlocking oder flashing) kompatibel ist, der kann sich den Vodafone WebSessions USB Stick hier bestellen.

Related Posts:

Freier Monitoring Service von pingdom

Seit gestern bietet der schwedische IT Dienstleister Pingdom seinen Monitoringdienst in eingeschränktem Umfang kostenlos an.

Dabei kann man beispielsweise seine Website mit einem einfachen (oder custom) HTTP Check überwachen, Netzwerk Checks über UDP, TCP oder einfachen Ping einrichten oder auch Dienste wie POP3, IMAP und SMTP prüfen lassen. In der kostenlosen Version kann man jedoch nur einen Host/IP überwachen. Allerdings kann man Meldungen dann an mehrere Kontakte verschicken, die wahlweise per EMail und/oder SMS über den Status benachrichtigt werden (20 SMS pro Monat sind inklusive).
Der Clou an der Sache ist, dass Pingdom Monitoring Hubs an verschiedenen Standorten auf der ganzen Welt betreibt, und so werden die Dienste beispielsweise aus Montreal (Kanada), London (UK), Dallas (Texas), Stockholm und Amsterdam überwacht!
Die Statistiken und Reports sind schön aufbereitet und es gibt sogar eine IPhone App!

Links:
Pingdom Homepage

Related Posts:

7 Jahre diginights.com – Zahlen und Fakten

Das Party Portal diginights.com ist nun 7 Jahre alt! Das wurde am Wochenende natürlich gebührend gefeiert und nun ist es an der Zeit wie schon vor 2 Jahren ein kleines Fazit zu ziehen.

Im Monat Mai 2009 hatten wir im Schnitt 7,462.3 Besucher pro Tag (Gemessen mit awstats bei 30 Minuten Session Timeout). Stärkste Tage sind momentan der Freitag, Samstag und Sonntag, wir meistens über 9.000 und bei besonderen Events sogar bis zu 12.000 Visits auf die Seite messen.
Pro Tag generieren wir mit der Seite, den Bildern und dem Forum mittlerweile zwischen 7 GB und 30GB reinen Webtraffic pro Tag (vgl. 5-12GB vor 2 Jahren). Für den Monat Mai 2009 hielt der Zähler bei 360,5GB Traffic an, der von insgesamt 231,331 Besuchern erzeugt wurde.

Die Browser Verteilung hat sich auch ein wenig geändert: Von den vormals 2/3 Anteilen des Internet Explorer sind nur noch 41,9 % geblieben. In Führung liegt nun Mozilla Firefox mit stolzen 52,8 %. Der Rest verteilt sich auf Safari mit 2,0%, der somit den Opera (1,7%) hinter sich lässt.

Seit dem 1. Januar 2004 finden sich mittlerweile stolze 409,274 Bilder auf unseren Servern und wurden auf über 5600 verschiedenen Events geschossen (Diese beiden Zahlen haben sich in 2 Jahren verdoppelt).
Die Bilder wurden insgesamt 94.064.542 mal angeschaut, einzelne Top Bilder wurden sogar über 6000 mal angesehen!

Im Forum gibts mittlerweile 1,196,770 Posts, geschrieben in 37,726 verschiedenen Threads.

Die Technik hinter diginights.com hat sich kaum geändert. Die Server sind gemietet von Hetzner Online in Nürnberg. Als Betriebssystem verwenden wir Debian Lenny in einer typischen LAMP Umgebung. Als Webserver kommen Apache2 zum Einsatz – Bilder, Beiträge und sonstiges wird in einer MySQL 5 Datenbank abgelegt. Hauptbestandteil der Seite ist das PHP5 basierende Webframework Symfony. Zusätzlich verwenden wir Tools wie trac, subversion, den freien adserver Open-X, php-apc, Munin und nagios.

Related Posts: