Not all locations considered

mdeinum nginx-forum at nginx.us
Mon Jul 23 15:14:19 UTC 2012


Hi All,

For a web application we have developed we wanted to use nginx as a
reverse proxy but I have some trouble/weird issues when setting it up.
Itseemds that part of my configuration is ignored, it appears it has to
do with the order and amount of locations (but that is at first sight).
We use nginx in a windows environment (on our test servers).

So what we wanted to is for a couple of applications create a single
entry point (main-server on port 81) now when a request comes in for
(/app1, /app2, /app3, /app4 it should pass it on to
main-servier:9090/appX) For /app5 and /app6 it should forward to server1
or server2 .

Our configuration is as follows (tried with and without ^~ but the same
result).

--
worker_processes  1;

error_log  logs/error.log  debug;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    gzip  on;

    server {
        listen       main-server:81;

	location ^~ /app5 {
		include proxy.conf;
		proxy_pass http://server2:9080/sub-path/app5;
	}

	location ^~ /app1 {
		include D:/nginx/conf/proxy.conf;
		proxy_pass http://127.0.0.1:9080/app1;
	}

	location ^~ /app2{
		include proxy.conf;
		proxy_pass http://127.0.0.1:9080/app2;
	}

	location ^~ /app3 {
		include proxy.conf;
		proxy_pass http://127.0.0.1:9080/app3;
	}

	location ^~ /app4{
		include proxy.conf;
		proxy_pass http://127.0.0.1:9080/app4;
	}

	location ^~ /app6 {
		include proxy.conf;
		proxy_pass http://server1:9081/app6;
	}

    }

}
--
Now if I comment app3 and app4 app5 works, if I don't app5 does't work.
I get 404 errors. If I check the debug log I see it only checks app1,
app2, app3 and then it tells me using configuration "", after which it
tries to load the file from the file system. I'm not experienced enough
to see or deduct what is wrong (apparently :) ). So I'm looking for
pointers to the solution (or even better the solution).

Thanks,
 Marten

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,228885,228885#msg-228885



More information about the nginx mailing list