Reading from a named pipe / fifo

takigama nginx-forum at nginx.us
Sat Jan 21 17:40:49 UTC 2012


Max Wrote:
-------------------------------------------------------
> Unfortunately,
> the other app can provide the data only through a
> fifo and there's no easy way to change it due to
> licensing, so writing a fifo module for nginx
> would be the easier and cleaner solution. Igor and
> other developers, could you please give me a few
> tips to help me get started with the development
> of the fifo module? Thank you,
> Max

Personally, the way i'd do it is to write a bit of php (or python, perl,
etc) called via fast cgi to read your fifo (be mindful of the blocking
nature of pipes which can cause such things to hang waiting for input).

but,
http://squirrelshaterobots.com/programming/php/building-a-queue-server-in-php-part-3-accepting-input-from-named-pipes/
is an example of reading a fifo from php. And it would be quite easy to
do something like this (kinda off the top of my head):

        location /location/of/my/fifo.html {
                include /etc/nginx/fastcgi_params;
                fastcgi_pass
unix:/var/run/php-fastcgi/php-fastcgi.socket;
                fastcgi_param SCRIPT_FILENAME
/path/to/local/php/that/reads/pipe.php;
        }

within the nginx config...

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221499,221507#msg-221507



More information about the nginx mailing list