nginx not forwarding requests to backend servers.

Brian Pugh project722 at gmail.com
Wed Jul 27 15:24:50 UTC 2016


What request do you make of nginx?

Requests come into nginx as https://myapplicationsite.net"

On the actual backend server, that request is then redirected to:

https://myapplicationsite.net//app/service/login?url=%2Fl

That brings up the login page on the backend server.

Which of your defined location{} blocks does it match:

  location / {
  location = /50x.html {
  location ~ \.php$ {

This is another part I am not sure how to setup. Since I am not passing any
php scripts I would have to say it matches the

location /{} block.

So I have now modified that section of code to read:

location / {
        #root   /usr/share/nginx/html;
        root    /app/service/login?url=%2Fl;
        index  index.html index.htm;
    }

And now, I get a different behavior once these changes are made. It now
fails with a 404 not found and in the logs I see:

2016/07/27 10:06:46 [error] 26994#26994: *3
"/app/service/login?url=%2Fl/index.html" is not found (2: No such file or
directory), client: 192.168.254.202, server: myapplicationsite.net,
request: "GET / HTTP/1.1", host: "myapplicationsite.net"

It cannot guess what you want it to do.

Right, I get that. I am a newb at nginx so I am looking for guidance on how
to set all this up, which is why I posted my complete configs and described
exactly what I wanted to accomplish.

So, to recap, I have 3 backend servers that can accept connections using
the following hostnames:

backendappsite1.net
backendappsite2.net
backendappsite3.net

The hostname that maps to nginx is myapplicationsite.net. What I want to
happen is anytime a request for myapplicationsite.net hits nginx, it get
sent to one of the servers above in a round robin fashion. Can anyone give
me an example config of what it would look like in both nginx.conf and
default.conf using the names/info I have provided?


On Wed, Jul 27, 2016 at 9:48 AM, Francis Daly <francis at daoine.org> wrote:

> On Wed, Jul 27, 2016 at 07:33:31AM -0500, Brian Pugh wrote:
>
> Hi there,
>
> > I am using nginx as a load balancer. However when I type in the URL for
> my
> > site, which resolves to the IP of the load balancer, I get the default
> > nginx page saying "nginx has been setup more configuration is required".
> I
> > would expect nginx to forward my request through to the backend servers I
> > have defined.
>
> What request do you make of nginx?
>
> Which of your defined location{} blocks does it match:
>
>   location / {
>   location = /50x.html {
>   location ~ \.php$ {
>
> > And oddly enough, there is very little in the way of logging
> > going on, to tell me why its failing.
>
> You wrote that it is returning some content, presumably with a http
> 200. That suggests that it is not failing to do what you told it to do.
>
> It cannot guess what you want it to do.
>
> >     Can anyone help my get requests to go to the backend servers? Is
> there
>
> Try a request that ends with ".php" ?
>
> Use "curl -v" and copy-paste the output, if it is not what you expect.
>
> > any other config or depenency apps needed that I may not have installed
> or
> > running? Also is there a way to enable more advanced debug logging to
> give
> > me a better idea whats going on?
>
> There is the "debug log", which is "extra stuff written to the error log":
>
> http://nginx.org/en/docs/debugging_log.html
>
> Cheers,
>
>         f
> --
> Francis Daly        francis at daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160727/bd2a9273/attachment.html>


More information about the nginx mailing list