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

**URL:** <https://www.ruby-forum.com/t/nginx-as-a-reverse-proxy-dor-several-internal-services-and-ssl-endpoint/135980>\
**Category:** NGINX\
**Created:** [April 27, 2008, 2:36pm UTC](https://www.ruby-forum.com/t/nginx-as-a-reverse-proxy-dor-several-internal-services-and-ssl-endpoint/135980 "2008-04-27T14:36:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Norbert\_Klamann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@Norbert\_Klamann](https://www.ruby-forum.com/u/Norbert_Klamann)\
**Post date:** [April 27, 2008, 2:36pm UTC](https://www.ruby-forum.com/t/nginx-as-a-reverse-proxy-dor-several-internal-services-and-ssl-endpoint/135980/1 "2008-04-27T14:36:37Z")

</div>

Hello list,  
I want to use nginx as a ssl-Endponit and semi-public face to some  
internal  
wenservicese like trac, nagios and squirrelmail. These services run on  
other  
(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  
404.

I see the Nagios start page at [https://intern.mydomain.de/nagios/](https://intern.mydomain.de/nagios/) but  
when I  
click the link to the ‘Tactical overview’ it looks like this

[https://intern.mydomain.de/cgi-bin/nagios2/tac.cgi](https://intern.mydomain.de/cgi-bin/nagios2/tac.cgi)

and leads to a 404

I have a hard time to ‘get’ this rewrite and redirection stuff and see  
some  
inconsitency in the descriptions here  
[http://wiki.codemongers.com/NginxHttpProxyModule#proxy\_pass](http://wiki.codemongers.com/NginxHttpProxyModule#proxy_pass)

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;  
server\_name [intern.mydomain.de](http://intern.mydomain.de)  
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$ [https://intern.projecthome.de/nagios/](https://intern.projecthome.de/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’  
instance.

## 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): ------- url\_html\_path=/nagios2 -------

Thanks for listening and for nginx itself !

Norbert  
[

---

<div class="post-metadata">

**Author:** ![Norbert\_Klamann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@Norbert\_Klamann](https://www.ruby-forum.com/u/Norbert_Klamann)\
**Post date:** [April 29, 2008, 11:11am UTC](https://www.ruby-forum.com/t/nginx-as-a-reverse-proxy-dor-several-internal-services-and-ssl-endpoint/135980/2 "2008-04-29T11:11:23Z")

</div>

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

[http://wiki.codemongers.com/NginxProxyNagios](http://wiki.codemongers.com/NginxProxyNagios)

All the best

Norbert
