Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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