# Host -\> jail -\> host - BAD GATEWAY

**URL:** <https://www.ruby-forum.com/t/host-jail-host-bad-gateway/198708>\
**Category:** NGINX\
**Created:** [November 5, 2010, 9:13pm UTC](https://www.ruby-forum.com/t/host-jail-host-bad-gateway/198708 "2010-11-05T21:13:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [November 5, 2010, 9:13pm UTC](https://www.ruby-forum.com/t/host-jail-host-bad-gateway/198708/1 "2010-11-05T21:13:04Z")

</div>

Im using FreeBSD and jails. I have my postfix on host, and main http  
server in jail.

When I set in jail (192.168.1.2):

server {  
\<------\>listen 80;  
\<------\>server\_name [www.poczta.a.org](http://www.poczta.a.org) [poczta.a.org](http://poczta.a.org);  
\<------\>access\_log /var/log/nginx/poczta.a.org-access.log;

\<------\>location / {  
\<------\>\<------\> proxy\_pass [http://188.212.129.X](http://188.212.129.X);  
\<------\>\<------\> proxy\_set\_header X-Real-IP $remote\_addr;  
\<------\>\<------\> proxy\_set\_header Host $http\_host;  
\<------\>}  
}

188.212.129.X it is my host IP.

I must set nginx on host, because without this my www mail client  
(roundcube) dont working. I cant install postfix in jail. How to fix it?

Posted at Nginx Forum:

> **[host -\> jail -\> host - BAD GATEWAY](https://forum.nginx.org/read.php?2,148117,148117#msg-148117)**
>
> Im using FreeBSD and jails. I have my postfix on host, and main http server in jail. When I set in jail (192.168.1.2): server { \<------\>listen 80; \<------\>server\_name www.poczta.a.org poczta.a.org; \<------\>access\_log /var/log/ngi

---

<div class="post-metadata">

**Author:** ![dong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3e96dc/32.png) [@dong](https://www.ruby-forum.com/u/dong)\
**Post date:** [November 5, 2010, 9:20pm UTC](https://www.ruby-forum.com/t/host-jail-host-bad-gateway/198708/2 "2010-11-05T21:20:36Z")

</div>

On Fri, Nov 5, 2010 at 1:11 PM, dong [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Im using FreeBSD and jails. I have my postfix on host, and main http  
> server in jail.

why bother with a jail maybe? 😛

---

<div class="post-metadata">

**Author:** ![dong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3e96dc/32.png) [@dong](https://www.ruby-forum.com/u/dong)\
**Post date:** [November 5, 2010, 9:25pm UTC](https://www.ruby-forum.com/t/host-jail-host-bad-gateway/198708/3 "2010-11-05T21:25:08Z")

</div>

I cant install postfix in jail… its problem 🙂

Posted at Nginx Forum:

> **[Re: host -\> jail -\> host - BAD GATEWAY](https://forum.nginx.org/read.php?2,148117,148122#msg-148122)**
>
> Im using FreeBSD and jails. I have my postfix on host, and main http server in jail. When I set in jail (192.168.1.2): server { \<------\>listen 80; \<------\>server\_name www.poczta.a.org poczta.a.org; \<------\>access\_log /var/log/ngi

---

<div class="post-metadata">

**Author:** ![dong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3e96dc/32.png) [@dong](https://www.ruby-forum.com/u/dong)\
**Post date:** [November 5, 2010, 9:30pm UTC](https://www.ruby-forum.com/t/host-jail-host-bad-gateway/198708/4 "2010-11-05T21:30:09Z")

</div>

yes - don’t use jails at all. nginx is pretty secure, as is postfix…  
😛

---

<div class="post-metadata">

**Author:** ![dong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3e96dc/32.png) [@dong](https://www.ruby-forum.com/u/dong)\
**Post date:** [November 5, 2010, 9:43pm UTC](https://www.ruby-forum.com/t/host-jail-host-bad-gateway/198708/5 "2010-11-05T21:43:21Z")

</div>

of course.

2010/11/5 Jérôme Loyet [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![dong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3e96dc/32.png) [@dong](https://www.ruby-forum.com/u/dong)\
**Post date:** [November 5, 2010, 9:39pm UTC](https://www.ruby-forum.com/t/host-jail-host-bad-gateway/198708/6 "2010-11-05T21:39:34Z")

</div>

2010/11/5 Michael S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> yes - don’t use jails at all. nginx is pretty secure, as is postfix… 😛

yes until a security hole is discovered …

---

<div class="post-metadata">

**Author:** ![dong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3e96dc/32.png) [@dong](https://www.ruby-forum.com/u/dong)\
**Post date:** [November 5, 2010, 10:00pm UTC](https://www.ruby-forum.com/t/host-jail-host-bad-gateway/198708/7 "2010-11-05T22:00:19Z")

</div>

Anybody have other idea? 🙂

Posted at Nginx Forum:

> **[Re: host -\> jail -\> host - BAD GATEWAY](https://forum.nginx.org/read.php?2,148117,148135#msg-148135)**
>
> Im using FreeBSD and jails. I have my postfix on host, and main http server in jail. When I set in jail (192.168.1.2): server { \<------\>listen 80; \<------\>server\_name www.poczta.a.org poczta.a.org; \<------\>access\_log /var/log/ngi

---

<div class="post-metadata">

**Author:** ![dong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3e96dc/32.png) [@dong](https://www.ruby-forum.com/u/dong)\
**Post date:** [November 5, 2010, 10:41pm UTC](https://www.ruby-forum.com/t/host-jail-host-bad-gateway/198708/8 "2010-11-05T22:41:04Z")

</div>

On Fri, 2010-11-05 at 16:11 -0400, dong wrote:

> \<------\>location / {  
> \<------\>\<------\> proxy\_pass [http://188.212.129.X](http://188.212.129.X);  
> \<------\>\<------\> proxy\_set\_header X-Real-IP $remote\_addr;  
> \<------\>\<------\> proxy\_set\_header Host $http\_host;  
> \<------\>}  
> }
> 
> 188.212.129.X it is my host IP.

I’m not too familiar with BSD or BSD jails, but it sounds like a network  
configuration issue rather than an Nginx issue. I’d first make sure  
that 188.212.129.X is actually reachable from inside the jail. Then  
make sure that whatever you are proxying to on the public IP is actually  
listening there on port 80. Then make sure you aren’t filtering  
packets to that 188.212.129.X:80 or that you at least have an exception  
for 192.168.1.2.

Overall, I’m pretty confused as to what you are trying to accomplish by  
proxying from a jail with a private IP address to a service that  
apparently resides on a public IP address, since you could simply bypass  
the proxy and access the public IP directly.

Cliff

–  
Cliff W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
