Forum: NGINX Nginx load balancer with GeoIP

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
103e3ecb1c838c6c7e52a0ee12ee6e1a?d=identicon&s=25 Glen Lumanau (Guest)
on 2008-11-11 04:19
(Received via mailing list)
Hi there,



Is nginx will support load balancing with GeoIP support?



Example :

If match country US

                Proxy_pass http://us.server/;

If match other

                Proxy_pass http://default.server/;





Regards,



Glen Lumanau
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-11-11 07:48
(Received via mailing list)
On Tue, Nov 11, 2008 at 10:10:42AM +0700, Glen Lumanau wrote:

> If match other
>
>                 Proxy_pass http://default.server/;

http {
      geo  $geo  {
         default      default;
         1.1.1.0/24   us;
         1.1.2.0/24   us;
         1.1.3.0/24   us;
         ...
      }

      upstream  us.server {
          ....
      }

      upstream  default.server {
          ....
      }

      server {
           location / {
               proxy_pass  http://$geo.server;
           }
103e3ecb1c838c6c7e52a0ee12ee6e1a?d=identicon&s=25 Glen Lumanau (Guest)
on 2008-11-11 08:26
(Received via mailing list)
How do I spread connection if I use
./geo2nginx.pl GeoIPCountryWhois.csv > geo.conf


Regards,

Glen Lumanau
103e3ecb1c838c6c7e52a0ee12ee6e1a?d=identicon&s=25 Glen Lumanau (Guest)
on 2008-11-12 08:42
(Received via mailing list)
If our protocol is RTSP which is using port 554, is that posibble to
load
balancing with nginx?
If yes, how can I do it? Because I got 400 Error (Bad Request) on
access.log


Regards,

Glen Lumanau
103e3ecb1c838c6c7e52a0ee12ee6e1a?d=identicon&s=25 Glen Lumanau (Guest)
on 2008-11-12 08:56
(Received via mailing list)
When using it for HTTP request, it show me error on my browser

Bad Request

Your browser sent a request that this server could not understand.

Here's my configuration

    geo $geo {
        default default;
    include geo.conf;
    }

    upstream ID.server {
        server 10.50.12.123;
    }

    upstream default.server {
        server 1.2.3.4;
    }

server {
    listen          10.50.12.134:80;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_pass http://$geo.server;

Anyone know how to fix this?


Regards,

Glen Lumanau
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-11-12 09:29
(Received via mailing list)
On Wed, Nov 12, 2008 at 02:35:03PM +0700, Glen Lumanau wrote:

> If our protocol is RTSP which is using port 554, is that posibble to load
> balancing with nginx?
> If yes, how can I do it? Because I got 400 Error (Bad Request) on access.log

No, only HTTP is supported.
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-11-12 09:30
(Received via mailing list)
On Wed, Nov 12, 2008 at 02:49:10PM +0700, Glen Lumanau wrote:

>     include geo.conf;
> server {
>     listen          10.50.12.134:80;
>
>     location / {
>         proxy_set_header X-Real-IP $remote_addr;
>         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>         proxy_set_header Host $host;
>         proxy_pass http://$geo.server;

-         proxy_pass http://$geo.server;
+         proxy_pass http://$geo.server$request_uri;
103e3ecb1c838c6c7e52a0ee12ee6e1a?d=identicon&s=25 Glen Lumanau (Guest)
on 2008-11-12 10:12
(Received via mailing list)
Thank's Igor it's works successfull.

Onother question is, are we using the Load Balancer bandwidth also to
send
the data to the client?
Because what we do is, I'm mirroring the server in my country, and I
have
onother server which is located in US

Also, I already install mod_rpaf on the apache, and set
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://$geo.server$request_uri;

But what I received on the apache logs, is still the load balancer IP,
not
the public IP


Regards,

Glen Lumanau
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-11-12 10:44
(Received via mailing list)
On Wed, Nov 12, 2008 at 04:03:57PM +0700, Glen Lumanau wrote:

>         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>         proxy_pass http://$geo.server$request_uri;
>
> But what I received on the apache logs, is still the load balancer IP, not
> the public IP

You should add mod_rpaf ( http://stderr.net/apache/rpaf/ ) to Apache.
103e3ecb1c838c6c7e52a0ee12ee6e1a?d=identicon&s=25 unknown (Guest)
on 2008-11-12 10:46
(Received via mailing list)
I already install and load mod_rpaf like already described from my
previous email

Regards,

Glen Lumanau
-
Sent from my BlackBerry®
103e3ecb1c838c6c7e52a0ee12ee6e1a?d=identicon&s=25 unknown (Guest)
on 2008-11-12 12:53
(Received via mailing list)
Will onother protocol be supported? Such as streaming and mysql load
balancing

Regards,

Glen Lumanau
-
Sent from my BlackBerry®
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-11-13 03:57
(Received via mailing list)
On Wed, Nov 12, 2008 at 09:40:29AM +0000, glen@lumanau.web.id wrote:

> I already install and load mod_rpaf like already described from my previous email

Sorry, I've missed this line.

Can describe what address you see in this form:

1.1.1.1 (LB) > 2.2.2.2 (nginx) > 3.3.3.3 (apache)

?

What do you use as Load Balancer ?
103e3ecb1c838c6c7e52a0ee12ee6e1a?d=identicon&s=25 Glen Lumanau (Guest)
on 2008-11-13 04:01
(Received via mailing list)
Right now I just use
1.1.1.1 (nginx)   > 2.2.2.2 (apache)
      > 3.3.3.3 (apache) --> located on different country

Nginx load balanced with 2 apache servers.

Also what about the bandwidth that's used for accessing 3.3.3.3? It's
using
1.1.1.1 bandwidth to access 3.3.3.3?


Regards,

Glen Lumanau
103e3ecb1c838c6c7e52a0ee12ee6e1a?d=identicon&s=25 Glen Lumanau (Guest)
on 2008-11-13 04:09
(Received via mailing list)
Sorry please ignore my previous email. I forgot to enable the rpaf with
RPAFenable On
RPAFproxy_ips 127.0.0.1 REALIP1 REALIP2
RPAFsethostname On

How about the bandwidth issue?


Regards,

Glen Lumanau
This topic is locked and can not be replied to.