proxy server needs to point to two servers
Francis Daly
francis at daoine.org
Sat Jun 30 11:41:25 UTC 2012
On Fri, Jun 29, 2012 at 05:20:02PM -0400, x7311 wrote:
Hi there,
> The public domain is actually an ip-address of the server. Let's called
> it 999.99.99.99
If you want two different server{} blocks, then with your setup you must
use two different hostnames to access them.
The default server could use the ip address; the dev server must use
something else. The easiest way is probably to add an address/name
pair to the hosts file on your client (web browser) machine, so that
your 999.99.99.99 resolves to "dev.example.com" for you.
I see below that you have done something like this.
Then put "server_name dev.example.com" in the server block that refers
to the dev system.
(An alternative is to continue using just the address to access the server;
but then you probably want both configurations in the same server{}
block, and you will have to change something to make sure that the right
request goes to the right proxy_pass upstream server.
Depending on what your upstream does, that may or may not be easy.)
> I can now ping dev.999.99.99.99 but I think this is so laughable... it
> seems like I don't really know what I am doing :(
This is "networking", not "nginx". Do whatever ssh'ing that you already
do, using *only* the ip addresses like you already do. (If you need
an ssh tunnel to get to the ip:port of nginx, then you only need one
tunnel to get to both the live and dev servers, because they are on the
same ip:port.)
The only extra change to make it that in your web browser, use the
dev.whatever name. If you want to test from a different machine, you
must also add the temporary entry into the hosts file there.
And you must make sure that you use the same dev.whatever name in (a)
your web browser; (b) your hosts file; and (c) your nginx conf file.
Your examples seem to use different numbers of 9s.
Good luck with it,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list