# PNP4Nagios Configuration
location /pnp4nagios {
    alias /usr/local/pnp4nagios/share;
    index index.php;
    try_files $uri $uri/ @pnp4nagios;
}

location @pnp4nagios {
    if ( $uri !~ /pnp4nagios/index.php(.*)) {
        rewrite ^/pnp4nagios/(.*)$ /pnp4nagios/index.php/$1;
        break;
    }

    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include /etc/nginx/fastcgi_params;
    # this splits out the trailing path
    # eg index.php?host -> $fastcgi_path_info == 'host'
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param SCRIPT_FILENAME /usr/local/pnp4nagios/share/index.php;
}

