how to use my own FD in NGINX

agentzh agentzh at gmail.com
Mon May 2 06:18:25 MSD 2011


On Thu, Mar 24, 2011 at 4:37 PM, Philippe RAZAVET
<razavet at stg-interactive.com> wrote:
> Hi
>
> I plan to use NGINX HTTP server on Linux, it uses epoll event loop.
>
> I want to develop a NGINX proxy module using File Descriptors of my
> own (not TCP socket) to forward the requests to a back-end service, and let
> NGINX adds those FDs in his epoll FD set, to handle the responses.
>
> What are the steps to achieve this goal ? (I suppose it is much work
> than a simple proxy module, maybe involving upstream and event module
> development ?)
>

The ngx_drizzle [1] and ngx_postgres [2] modules do register their own
fd's into the nginx event model. You can take a look at their source
code. The ngx_http_upstream module can serve as some kind of a basis,
but it is very limited in its design so we extend it a lot in the two
modules mentioned above and bypass about half of its code paths.

Cheers,
-agentzh

[1] https://github.com/chaoslawful/drizzle-nginx-module
[2] https://github.com/FRiCKLE/ngx_postgres



More information about the nginx-devel mailing list