Thruk + NGINX + authentication

Dec. 30, 2011

Sometimes, when one line is missing, the whole system seems broken.

Hello.

As you know it, I use NGINX on a daily basis. And yesterday evening, I worked on installing NGINX on the last server which used Apache, but it hosts Shinken + Thruk.

And the problems arrive with Thruk.

He uses his CGI server, as the configuration with Apache is simple and well documented, I never tried to fully understand this configuration.

But with NGINX, it’s totally different.

My thruk is installed in /opt/thruk.

Here is the configuration part for thruk in my NGINX configuration :

location /thruk { auth_basic “Monitoring Access”; auth_basic_user_file /opt/thruk/htpasswd.users; fastcgi_index index.cgi; fastcgi_param REMOTE_USER $remote_user; fastcgi_pass unix:/tmp/thruk_fastcgi.socket; include fastcgi_params; }

Above all, DON’T FORGET the line “fastcgi_param REMOTE_USER $remote_user;”, which transmit the logged user to thruk, who will recognize it and allow you to access the interface.

Big cheers to ScriptFanix on the IRC channel #shinken on Freenode for helping me with this issue.

Thanks.