0

I have written two C++ fastcgi applications (foo and foobar). I am running apache 2.2 (prefork) with mod_fcgid on Ubuntu 10.x.

I want to be able to setup apache so that:

http://mywebsite/some/path1?param1=value1&param2=value2

will run the fastcgi app foo

AND

mywebsite/another/path1?param1=value1&param2=value2

will run the fastcgi app foobar

Note: The url above is intentionally invalid (missing the protocol type), since I cant post more than 1 link in this question.

How do I setup apache to achieve this?

1

The easiest way is to use a FcgidWrapper directive with 'virtual' turned on. This means Apache won't even try to find the "real" file, just call the fcgi script instead.

DocumentRoot /whatever

<Directory /whatever/some/path1>
    FcgidWrapper /elsewhere/bin/foo virtual
</Directory>

<Directory /whatever/another/path1>
    FcgidWrapper /elsewhere/bin/foobar virtual
</Directory>

Alternatively, you could use mod_rewrite something like this:

DocumentRoot /whatever

<Directory /whatever>
    RewriteRule /some/path1 /fcgi/foo 
    RewriteRule /another/path1 /fcgi/foobar
</Directory>

<Directory /whatever/fcgi>
    SetHandler fcgid-script
</Directory>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.