location /icinga-web/styles {
    alias /usr/local/icinga-web/pub/styles;
}
 
location /icinga-web/images {
    alias /usr/local/icinga-web/pub/images;
}

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

location /icinga-web/modules/([A-Za-z0-9]*)/resources/images/([A-Za-z_\-0-9]*\.(png|gif|jpg))$ {
    alias /usr/local/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/local/icinga-web/app/modules/$1/pub/styles/$2;
}

location /icinga-web/modules/BPAddon/resources {
    alias /usr/local/icinga-web/app/modules/BPAddon/pub;
}

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/local/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/local/icinga-web/pub/index.php;
}

