# Multiple https proxy\_pass to diffrent apache server

**URL:** <https://www.ruby-forum.com/t/multiple-https-proxy-pass-to-diffrent-apache-server/215753>\
**Category:** NGINX\
**Created:** [January 14, 2012, 4:18pm UTC](https://www.ruby-forum.com/t/multiple-https-proxy-pass-to-diffrent-apache-server/215753 "2012-01-14T16:18:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 14, 2012, 4:18pm UTC](https://www.ruby-forum.com/t/multiple-https-proxy-pass-to-diffrent-apache-server/215753/1 "2012-01-14T16:18:32Z")

</div>

Hello everybody,

The relevant part of the config:  
[http://paste.debian.net/hidden/9d3d8f16/](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/](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/](https://192.168.24.67/);  
}  
}

I want to add several more server\_names if possible.

Thanks in advance,

Kind regards,

Jelle

---

<div class="post-metadata">

**Author:** ![Jelle\_de\_Jong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b782af/32.png) [@Jelle\_de\_Jong](https://www.ruby-forum.com/u/Jelle_de_Jong)\
**Post date:** [January 14, 2012, 5:34pm UTC](https://www.ruby-forum.com/t/multiple-https-proxy-pass-to-diffrent-apache-server/215753/2 "2012-01-14T17:34:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jelle\_de\_Jong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b782af/32.png) [@Jelle\_de\_Jong](https://www.ruby-forum.com/u/Jelle_de_Jong)\
**Post date:** [January 14, 2012, 5:42pm UTC](https://www.ruby-forum.com/t/multiple-https-proxy-pass-to-diffrent-apache-server/215753/3 "2012-01-14T17:42:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jelle\_de\_Jong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b782af/32.png) [@Jelle\_de\_Jong](https://www.ruby-forum.com/u/Jelle_de_Jong)\
**Post date:** [January 14, 2012, 6:58pm UTC](https://www.ruby-forum.com/t/multiple-https-proxy-pass-to-diffrent-apache-server/215753/4 "2012-01-14T18:58:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jelle\_de\_Jong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b782af/32.png) [@Jelle\_de\_Jong](https://www.ruby-forum.com/u/Jelle_de_Jong)\
**Post date:** [January 14, 2012, 5:48pm UTC](https://www.ruby-forum.com/t/multiple-https-proxy-pass-to-diffrent-apache-server/215753/5 "2012-01-14T17:48:56Z")

</div>

On 14.01.2012 17:17, Jelle de Jong wrote:

> The relevant part of the config: [225 for you to know anything of the historical sense, which had pushed themselves through.](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?

> **[Configuring HTTPS servers](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

---

<div class="post-metadata">

**Author:** ![Jelle\_de\_Jong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b782af/32.png) [@Jelle\_de\_Jong](https://www.ruby-forum.com/u/Jelle_de_Jong)\
**Post date:** [January 15, 2012, 12:27am UTC](https://www.ruby-forum.com/t/multiple-https-proxy-pass-to-diffrent-apache-server/215753/6 "2012-01-15T00:27:11Z")

</div>

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.
