mod_parsed_vars question

ryo sato sato at itboost.co.jp
Tue Sep 9 08:01:52 MSD 2008


Hi.

I want to balance with URLSessionID like
http://zzzzz.com/index.php?PHPSESSID=XXXXXX
                           ^^^^^^^^^^^^^^^^
So, I recompiled nginx-0.6.31 with mod_parsed_vars and nginx_upstream_hash.

But,it doesn't work correctly.

By the case,Japanese mobile phone doesn't accept cookies.
So, I want to sticky with URL.

Environment is like this.
   ┌────────┬────────┬────────┐
     │              │              │              │
┌──┴──┐  ┌──┴──┐  ┌──┴──┐  ┌──┴──┐
│    LB    │    │   Web    │    │   Web    │    │   Web    │
└─────┘  └─────┘  └─────┘  └─────┘


Details are below.

OS:CentOS5.2
Package: nginx-0.6.31-3.el5.src.rpm
        with mod_parsed_vars and nginx_upstream_hash patch.

Config:/etc/nginx/nginx.conf
=======================================================
user              nginx;
worker_processes  2;
error_log         /var/log/nginx/error.log;
pid               /var/run/nginx.pid;

events {
    worker_connections  2048;
    use epoll;
}

http {

    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local]
"$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent"';
    access_log  /var/log/nginx/access.log  main;

    # for session debug
    log_format session '$remote_addr - [$time_local] $request '
                 '$args_PHPSESSID' => $upstream_addr';
    access_log  /var/log/nginx/session.log  session;

#############################################################3
# www.zzzz.com
#############################################################3
    upstream www {
        server 1.1.1.1:80 max_fails=0 fail_timeout=2s;
        server 2.2.2.2:80 max_fails=0 fail_timeout=2s;
        server 3.3.3.3:80 max_fails=0 fail_timeout=2s;
        hash   $args_PHPSESSID;
    }

    server {
        listen 59.106.75.235:80;
        server_name 4.4.4.4;

        location / {
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_read_timeout 5;
            proxy_redirect false;
            proxy_pass http://www;
        }
    }
}
=======================================================

Please help.

-- 
Ryo Sato





More information about the nginx mailing list