I have been going at this for a day now. And I think it’s time to ask for help now.
I’m moving our nagios to nginx. I have nagios running as well as a django application I recently developed. Pnp4nagios is giving me some troubles though. I have the following configuration in Nginx.
location ~ ^(/pnp4nagios/.*\.php)(.*)$ {
root /usr/share/pnp4nagios/html;
include /etc/nginx/fastcgi_params;
rewrite ^/pnp4nagios/(.*)$ /$1 break;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /usr/share/pnp4nagios/html/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
}
This results in this:

As you can see, pnp4nagios thinks that its index.php lives in 172.16.10.28/index.php But this isn’t true. It is a sub-page (or whatever i should call it?). I want it to point to 172.16.10.28/pnp4nagios/index.php but I have no clue how I can do this in my nginx config. I would prefer not to change anything in pnp4nagios. But if it’s only one or a few lines it’s a compromise I’m willing to make. I already have an index.php in my “root” url. That’s why I want a subfolder.
The examples that have lead me to this aproach are:
Example1
Example2
So to recap what I want (or what I think that I need) is to go from this: img src="/index.php... to img src="/pnp4nagios/index.php...
PS. I didn’t have enough points to create a pnp4nagios tag
This worked for me: