About Nginx as reverse proxy?

Hello everyone,

After playing with nearly all, the very few complicated how-to’s created strictly for FreeBSD, I found the simplest one to use Nginx as reverse proxy but I still don’t have a clue of tools or alliances needed to test on a single machine. I don’t want to place everything in one jail because I may want to move these same jails to multiple servers someday. If I get the hang of things, then only minimal modification will be needed.

For now I’m trying to deal with two or more jails on the same machine; one for Nginx-Reverse-Proxy and the other with Apache with PHP. When I test each jail separately, they work. So I am half way there if there is a there.

Nginx on IP-10.0.0.1 is working:
Code:
Performing sanity check on nginx configuration:  …
Starting nginx.
#

Apache on IP-10.0.0.4 is working:
Code:
Performing sanity check on php-fpm configuration:  …
Starting php_fpm.

Performing sanity check on apache24 configuration: …
Starting apache24.
#

Calling from Firefox on the host, It works like a charm separately:
Code:
http://10.0.0.1:8080/
http://10.0.0.4:8080/info.php

How would I pass real-ips to apache or any other backend server? Can I fake real-ip with my virtual IP 10.x.x.x? How would I go about testing all of this on a single FreeBSD machine? I hope I am not completely off base, because no tutors I read don’t even mention something like this, ether because it’s not possible or they figure it should be common knowledge.

***** https://techknight.eu/2015/08/13/let-nginx-reverse-proxy-pass-real-ips-to-apache/

https://www.knthost.com/nginx/nginx-reverse-proxy-setup-freebsd
http://linoxide.com/linux-how-to/install-nginx-reverse-proxy-apache-freebsd-10-2/
http://docplayer.net/5955106-Running-nginx-as-reverse-proxy-server.html
http://www.howdididothat.info/2013/...che-for-all-domains-on-other-virtual-machine/
https://www.quora.com/Whats-the-difference-between-a-reverse-proxy-and-forward-proxy
http://selby.highfield-house.org.uk/?cat=9
http://kbeezie.com/apache-with-nginx/

Other than what’s here and at GIT, that’s just about all she wrote for FreeBSD :)
 
What I would do is have a single nginx facing the internet with your real IP and have that reverse proxy to your other jailed nginx instances using virtual hosts.

With regards to testing it on a single machine, if you have a single nginx with your real IP then you can just use the loopback adapter for your backend nginx and application servers.

Hope that helps, I'm not too clear on the question to be honest :)
 
Exactly what I needed to hear. I was trying to avoid facing the INTERNET with my IP and figure out how to do the loop-back thing. i'm going to rent a cheap VPS and learn from there like everybody else. Thanks a zillion Tabs@. This is so interesting, I think I’ll try this first;)

What I would do is have a single nginx facing the internet with your real IP and have that reverse proxy to your other jailed nginx instances using virtual hosts.
 
T
What I would do is have a single nginx facing the internet with your real IP and have that reverse proxy to your other jailed nginx instances using virtual hosts.

With regards to testing it on a single machine, if you have a single nginx with your real IP then you can just use the loopback adapter for your backend nginx and application servers.

Hope that helps, I'm not too clear on the question to be honest :)
That's exactly what I did ☝🏿🙂
 
You can test virtual hosts locally if you just modify your local hosts file.

Code:
192.168.1.12 some.site
192.168.1.12 other.site
Now you can access http://some.site and http://other.site, assuming the reverse proxy runs on 192.168.1.12 and has two reverse proxies for some.site and other.site.
 
Back
Top