Multiple https proxy_pass to diffrent apache server

Hello everybody,

The relevant part of the config:
http://paste.debian.net/hidden/9d3d8f16/

I want to proxy pass port 443 based on the server_name to different
Apache servers, anybody knows how should I do this?

Summary of the config: (see the above pastebin for more info)

server {
listen 443;
server_name calendar.powercraft.nl;
ssl on;
ssl_certificate /etc/ssl/certs/certificate.pem;
ssl_certificate_key /etc/ssl/certs/privatekey.pem;
keepalive_timeout 70;
location / {
proxy_redirect off;
proxy_pass https://192.168.24.66/;
}
}

server {
listen 443;
server_name webmail.tuxblogger.nl;
ssl on;
ssl_certificate /etc/ssl/certs/certificate.pem;
ssl_certificate_key /etc/ssl/certs/privatekey.pem;
location / {
proxy_redirect off;
proxy_pass https://192.168.24.67/;
}
}

I want to add several more server_names if possible.

Thanks in advance,

Kind regards,

Jelle

On Saturday 14 January 2012 19:17:37 Jelle de Jong wrote:

listen      443;

}

I want to add several more server_names if possible.

Probably something like this would work:

map $host $backend {
calendar.powercraft.nl 192.168.24.66;
webmail.tuxblogger.nl 192.168.24.67;
}

server {
listen 443;
server_name calendar.powercraft.nl webmail.tuxblogger.nl;

ssl on;
ssl_certificate     /etc/ssl/certs/certificate.pem;
ssl_certificate_key /etc/ssl/certs/privatekey.pem;

keepalive_timeout   70;

location / {
    proxy_pass  https://$backend/;
}

}

wbr, Valentin V. Bartenev

On Saturday 14 January 2012 20:33:45 Valentin V. Bartenev wrote:
[…]

location / {
    proxy_pass  https://$backend/;
}

Oops, correct:

proxy_pass https://$backend$uri;

wbr, Valentin V. Bartenev

On Saturday 14 January 2012 20:41:21 Valentin V. Bartenev wrote:

proxy_pass https://$backend$uri;

And, probably, you didn’t want proxy pass HTTPS to upstream:

proxy_pass http://$backend$uri;

I also expected that you have multi-domain certificate.

wbr, Valentin V. Bartenev

On 14.01.2012 17:17, Jelle de Jong wrote:

The relevant part of the config: http://paste.debian.net/hidden/9d3d8f16/

I want to proxy pass port 443 based on the server_name to different
Apache servers, anybody knows how should I do this?

http://nginx.org/en/docs/http/configuring_https_servers.html

 }
     proxy_pass          https://192.168.24.67/;
 }

}

I want to add several more server_names if possible.

yes, it is possible.

make separate server{ … } for each https site.

probably you need separate IP for each site,
or use only SNI-capable clients (browsers)


Best regards,
Gena

Hello!

On Sat, Jan 14, 2012 at 08:41:21PM +0400, Valentin V. Bartenev wrote:

On Saturday 14 January 2012 20:33:45 Valentin V. Bartenev wrote:
[…]

location / {
    proxy_pass  https://$backend/;
}

Oops, correct:

proxy_pass https://$backend$uri;

The $uri part isn’t needed, just

proxy_pass https://$backend;

is enough.

Maxim D.

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