Welcome! Log In Create A New Profile

Advanced

Not all locations considered

July 23, 2012 11:14AM
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
Subject Author Posted

Not all locations considered

mdeinum July 23, 2012 11:14AM

Re: Not all locations considered

Maxim Dounin July 23, 2012 11:54AM

Re: Not all locations considered

mdeinum July 24, 2012 08:05AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 153
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