Nginx as a reverse proxy dor several internal services and ssl-endpoint

Hello list,
I want to use nginx as a ssl-Endponit and semi-public face to some
wenservicese like trac, nagios and squirrelmail. These services run on
(virtual) boxes, nginx shall live in its own (virtual machine).

The web services run (for the time being) under apache2.

I installed the dev version 0.6.29 under ubuntu dapper

My problem is that I cannot reach the backends cleanly. For example I
can see
the nagios front page but the links to the cgis are wrong and lead to

I see the Nagios start page at but
when I
click the link to the ‘Tactical overview’ it looks like this

and leads to a 404

I have a hard time to ‘get’ this rewrite and redirection stuff and see
inconsitency in the descriptions here

the examples ther use 2 parameters to the proxy_pass statement, but this
leads to syntax errors and it is not clear what it should do at all.

This is the relevant part of the nginx.conf:

server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/ssl/intern_cert.pem;
ssl_certificate_key /etc/nginx/ssl/intern_private.key;
keepalive_timeout 70;
location / {
root html;
index index.html index.htm;
location /nagios/ {

rewrite ^/nagios$ break;

makes no difference

  proxy_pass  http://inagios:80/nagios2/;
  proxy_redirect http://inagios:80/nagios2/ /nagios/ ;


The proxy parameters are in a separate file and work fine for a ‘trac’

The apache config for the nagios server is this :

ScriptAlias /cgi-bin/nagios2 /usr/lib/cgi-bin/nagios2
ScriptAlias /nagios2/cgi-bin /usr/lib/cgi-bin/nagios2
Alias /nagios2 /usr/share/nagios2/htdocs
<DirectoryMatch (/usr/share/nagios2/htdocs|/usr/lib/cgi-bin/nagios2)>
Options FollowSymLinks

    AllowOverride AuthConfig
    Order Allow,Deny
    Allow From All

    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /etc/nagios2/htpasswd.users
    require valid-user

and the cgi configuration is this (excerpt):


Thanks for listening and for nginx itself !


Hello all,
I found the solution and described it in the wiki.

All the best


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs