2

For the last several years, I’ve been using a setup of NGINX as a reverse proxy that passes any dynamic content requests to Apache. Apache then uses mod_fcgid to autospawn FastCGI-enabled Perl scripts into listener processes. For complex Perl code this has been a huge benefit, keeping database connections going, etc.

I’m now trying to go with a pure NGINX setup that skips Apache, however, I cannot figure out how to achieve the same basic autospawning functionality. It seems like most FCGI discussions regarding NGINX assume one manually launches a daemon specific to the script in question. It either runs one instance of the Perl script or, with multiwatch can manage multiple copies for a greater number of requests (as mod_fcgid does), but the simple fact remains that one must anticipate which FastCGI enabled Perl scripts are going to be run, have them waiting on a socket and then tell NGINX specifically about that script.

If one is hosting multiple virtual servers and each one has scripts that might need to be loaded, this is much more complex than simply letting mod_fcgid spawn those scripts and respawn them if they die.

Is there a way to achieve a mod_fcgid-like arrangement, which auto spawns as fcgiwrap can do, but unlike fcgiwrap, is for FastCGI enabled scripts that should persist between requests? (Since fcgiwrap is a legacy CGI wrapper, it just runs the script once per request, rather than giving the true benefit of FastCGI.)

1 Answer 1

0

If you want, you can use my project designed exactly for that: https://github.com/vdudouyt/std-fpm

You can consider it a standalone mod_fcgid for Nginx, or as a kind of PHP-FPM without the PHP part.

It also lacks that nasty can't apply process slot problem mod_fcgid users experience if their scripts are unexpectedly exiting or performing long-running I/Os.

It's also in production use already, including some high-load setups.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.