server {
    listen 80;
    server_name dev.hamburg.freifunk.net;
   
    access_log off; # Bitte nicht aktivieren. Wir wollen ja nicht die IPs unserer Visitor loggen.

    # Bitte nur zum Debuggen von schweren Fehlern das Log-File temporär setzen und dann anschließend die Logs löschen.
    # So stellen wir sicher, dass keine IPs geloggt werden.
    error_log /dev/null crit;
   
    index index.php index.html index.htm;

    location = / {
	rewrite ^/$ /icinga-web/index.php permanent;
    }   

    # Security - Basic configuration
    location = /favicon.ico {
        log_not_found off;
        access_log off;
        expires max;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    # Deny access to hidden files
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }
   
    location /icinga-web/styles {
        alias /usr/share/icinga-web/pub/styles;
    }
 
    location /icinga-web/images {
        alias /usr/share/icinga-web/pub/images;
    }

    location /icinga-web/js {
        alias /usr/share/icinga-web/lib;
    }

    location /icinga-web/modules/([A-Za-z0-9]*)/resources/images/([A-Za-z_\-0-9]*\.(png|gif|jpg))$ {
        alias /usr/share/icinga-web/app/modules/$1/pub/images/$2;
    }

    location /icinga-web/modules/([A-Za-z0-9]*)/resources/styles/([A-Za-z0-9]*\.css)$ {
        alias /usr/share/icinga-web/app/modules/$1/pub/styles/$2;
    }

    location /icinga-web/modules {
        rewrite ^/icinga-web/(.*)$ /icinga-web/index.php?/$1 last;
    }

    location /icinga-web/web {
        rewrite ^/icinga-web/(.*)$ /icinga-web/index.php?/$1 last;
    }

    location ~ ^/modules {
        rewrite ^/modules/(.*)$ /icinga-web/modules/$1 permanent;
    }

    location /icinga-web {
        alias   /usr/share/icinga-web/pub;
        index index.php;
        try_files $uri $uri/ /icinga-web/index.php?$args;
    }

    location ~ /icinga-web/(.*)\.php($|/) {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(/icinga-web/.*\.php)(.*);
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME /usr/share/icinga-web/pub/index.php;
    }
}