All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
What's the best webserver for CGI scripts?
I have a CGI (Bash) script which forwards the output of an executable to a web client. However, I have some issues with it. I have tried two approaches to run the script:
python -m CGIHTTPServer &
This is a Python embedded web server which runs CGI scripts. It supports only one connection at a time (that's ok for my requirements).
lighttpd + mod_cgi
The problem in both cases is that my script does not get the terminate (or pipe failed) signal when the client disconnects. The end result with Python is that it gets stuck for awhile after the client disconnects (thus unable to process new client requests). The result with Lighttpd is a memory leak: as soon as the client disconnects Lighttpd starts to buffer the CGI output until it runs out of memory.
This is a low end system thus I am trying to avoid extra overhead (i.e. PHP). Any ideas are welcome.
Comments
Redhat or CentOS will best for you...
Can u elaborate? Which software in CentOS is best for this use case?
You can set some timeout for cgi scripts I think
How is running bash and python lighter weight than nginx and php???
I was able to do it with the thttpd server. It turns out my problem was somewhere lower in the stack as the TCP connections kept appearing as ESTABLISHED even after the client had disconnected.
So the final solution is to put a "killall" in the beginning of the bash script. Then compile thttpd with no limit for CGI execution time and limit of 2 simultaneous CGI instances. The end result is that only one CGI script can execute at a time, a subsequent request would kill the zombie script if it exists. Kind of hacky but works for my needs.
Have you tried server.max-write-idle ?
http://redmine.lighttpd.net/projects/1/wiki/Server_max-write-idleDetails
maximum number of seconds until a waiting write call times out and closes the connection
Did u try NGINX?
Nginx doesn't support cgi. Better using hiawatha instead lighttpd for cgi.
uWSGI works fine
thttpd is marvelous for cgi. But it's old and no longer maintained. I'd suggest you put nginx up front and forward cgi requests to thttpd on localhost.
Why? Do you know of any vulnerabilities with it?
I am thinking of having an Nginx reverse proxy on a dedicated load balancer. The thttpd machine is just a Raspberry Pi already overclocked and at 100% load, I can't really afford to add another layer of proxying.
Monkey is pretty good with CGI and FastCGI. Is pretty small too.