Welcome! Log In Create A New Profile

Advanced

configuration of 1000's entries

sv
September 27, 2013 07:24AM
I have many "virtual" paths on one nginx server. What I mean by this is
there can be many top level paths, where each one has a cookie, static
files, and a upstream server. The way I am doing it now is just
duplicate every path.

Is there a way to do this 'faster' 'less writing' 'better'? I am
expecting 1000's of entries.


upstream a1 {
# server localhost:48000;
unix:/tmp/a1
}
upstream a2 {
server localhost:48001;
# unix:/tmp/a2
}
upstream a3 {
# server localhost:48002;
unix:/tmp/a3
}

location /a1/exe { # to upstream if have cookie
if ($http_cookie !~* 'a1') {
rewrite ^a1(.*)$ /login?a1=$1;
}
proxy_.... #setup
proxy_pass http://a1;
}

location /a1 { # static files
if ($http_cookie !~* 'a1') {
rewrite ^a1(.*)$ /login?a1=$1;
}
alias /var/www/a1
}

location /a2/exe { # to upstream if have cookie
if ($http_cookie !~* 'a2') {
rewrite ^a2(.*)$ /login?a2=$1;
}
proxy_.... #setup
proxy_pass http://a2;
}

location /a2 { #static files
if ($http_cookie !~* 'a2') {
rewrite ^a2(.*)$ /login?a2=$1;
}
alias /var/www/a2
}

........
IDEA
*************
not correct!!
location / {
parse url
check cookie
if $2 == 'exe' {
proxy_pass
}
alias /var/www/$2 OR rewrite /var/www/$2
}

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

JSON REST APIs

Myla John-B22173 September 24, 2013 08:42PM

configuration of 1000's entries

sv September 27, 2013 07:24AM

Re: configuration of 1000's entries

Francis Daly September 27, 2013 01:36PM

extra ?

sv September 30, 2013 03:20AM

Re: extra ?

Maxim Dounin September 30, 2013 08:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 256
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready