Welcome! Log In Create A New Profile

Advanced

Re: proxy server needs to point to two servers

Francis Daly
June 30, 2012 07:42AM
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@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

proxy server needs to point to two servers

x7311 June 29, 2012 02:42PM

Re: proxy server needs to point to two servers

Francis Daly June 29, 2012 03:52PM

Re: proxy server needs to point to two servers

x7311 June 29, 2012 05:20PM

Re: proxy server needs to point to two servers

Francis Daly June 30, 2012 07:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 128
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready