Wuvist
June 17, 2010, 4:22pm
1
Hi, I’m new to Nginx. Really like it.
I was trying to use it as reverse proxy, with following config:
http {
upstream mobile{
hash $arg_userid
server 192.168.0.180;
server 192.168.0.2:80;
server 192.168.0.3:80;
}
server {
listen 80;
listen 8080;
server_name mobile.test.com;
location / {
proxy_pass http://mobile;
proxy_redirect off;
proxy_set_header Host $host;
}
}
}
The idea is to load balance the request according to “userid” parameter
in querystring.
It works when I visit: http://mobile.test.com:8080/?userid=XXX , but not
http://mobile.test.com/?userid=XXX
The request to 8080 port could be hash to different server correctly,
but the requests to 80 port just sent to random server.
I’m really puzzled.
Any feedback are welcome. Thanks.
Posted at Nginx Forum:
Hi, I'm new to Nginx. Really like it. I was trying to use it as reverse proxy, with following config: http { upstream mobile{ hash $arg_userid server 192.168.0.180; server 192.168.0.2:80; server 192.168.0.3:
Wuvist
June 17, 2010, 4:22pm
2
I’m using Nginx 0.7.66 with upstream hash-0.3 on Ubuntu 8.04.3 LTS.
My config cmd:
./configure
–prefix=/usr
–sbin-path=/usr/sbin/nginx
–conf-path=/etc/nginx/nginx.conf
–error-log-path=/var/log/nginx/error.log
–pid-path=/var/run/nginx.pid
–lock-path=/var/lock/nginx.lock
–user=www-data
–group=www-data
–with-http_gzip_static_module
–with-http_realip_module
–http-log-path=/var/log/nginx/access.log
–http-client-body-temp-path=/var/tmp/nginx/client/
–http-proxy-temp-path=/var/tmp/nginx/proxy/
–http-fastcgi-temp-path=/var/tmp/nginx/fcgi/
–add-module=…/nginx_upstream_hash-0.3.1/
Posted at Nginx Forum:
Hi, I'm new to Nginx. Really like it. I was trying to use it as reverse proxy, with following config: http { upstream mobile{ hash $arg_userid server 192.168.0.180; server 192.168.0.2:80; server 192.168.0.3: