Configure nginx as a tcp proxy for ejabberd

Hi,

I have the folowing configuration in nginx to function as a tcp proxy for ejabberd.

stream{
upstream ejabberd-servers{
server ejabberd:5222;
}
server{
listen 5222;
proxy_pass ejabberd-servers;
}
}

ejabberd is the hostname of the ejabberd server.

When I connect to nginx using smack client library, I get the error is SOCKS5 socket fail.

When I try connection using SOCKS4, I get Servers response VN 60

The reason I am trying to do so is because I do not want to expose ejabberd directly to the Internet. I need to have a proxy to load balance connections and also prevent DDos attacks.

Has anybody successfully done this previously?

That's what I'm using right

That's what I'm using right now inside nginx to avoid direct exposure of ejabberd:

    location /http-bind/ {              # BOSH XMPP-HTTP
#        limit_except POST { deny all; }
        proxy_pass http://localhost:5280;
        proxy_set_header Host $host;
    }

what do you think about it ?

Syndicate content