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