Keep Server Online|
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Apache Lounge is not sponsored.
Your donations will help to keep this site alive and well, and continuing building binaries.
Joined: 30 Jun 2007
|Posted: Sat 30 Jun '07 21:46 Post subject: Apache - httpd.conf - mod_fcgid config info
|Hi folks, I'm an Apache newbie who did some research / source code review and put together this quick intro to httpd.conf for folks configuring mod_fcgid - and it has some generally useful info for newbies setting up other modules as well. I'm specifically setting up mod_fcgid to call a C++ program written with the FastCGI developers kit from fastcgi.com - this doesn't cover PHP setup, something that I've seen a lot of discussion about elsewhere.
I am no expert at this, please post corrections if there are errors or omissions in my research. And please don't be upset if this should and doesn't help, I'd be happy to learn from your experiences as well as try to help you with mine.
First, the httpd.conf file is normally under the conf folder of your Apache installation. You'll add the following line to the block of LoadModule lines. I believe there's at least one other FastCGI module out there, so you'd need to modify this line with its module and file names if you have that one.
LoadModule fcgid_module modules/mod_fcgid.so
<IfModule> and related directives are used if you wish Apache to load without errors even if unexpected issues interfere with your FastCGI program.
See http://httpd.apache.org/docs/2.2/mod/core.html#ifdefine for details.
Use <Directory>, <DirectoryMatch>, <Location>, <LocationMatch>, <Files> or <FilesMatch> directives to specify which files are processed by your FastCGI program
The ~Match versions each allow use of regular expressions to describe complex matching.
For details see http://httpd.apache.org/docs/2.2/sections.html and http://httpd.apache.org/docs/2.2/mod/core.html
<Directory /filepath> [various directives] </Directory>
Applies the specified directives to files matching the file system path specifier, including any wildcards.
<Location /URL-path> [various directives] </Location>
Applies the specified directives to items that match the URL specifier, including any wildcards. Multiple slashes must be explicitly matched.
<Files filename> [various directives] </Files>
Applies directives to files that match the filename, including any wildcards. <Files> directives can be nested within <Directory> directives.
mod_fcgid declines the request if SetHandler is set to anything other than fcgid-script, use it even for compiled FastCGI programs.
ScriptAlias requests don't require this option, but everything else must specify it or mod_fcgid will decline requests.
See http://httpd.apache.org/docs/2.0/mod/mod_alias.html for info on mod_alias and the ScriptAlias directive.
See http://httpd.apache.org/docs/2.2/mod/core.html#options for information on other options.
FCGIWrapper /path/execname .ext
FCGIWrapper specifies the program that is used to process files ending with an extension of .ext exactly
The filename and extension must be exact, no wildcards are permitted, and the .ext must be a simple file extension starting with a period.
As of mod_fcgid v2.1 you can include program command line parameters if you enclose the entire path, execname and params in double quotes.
Order, Allow and Deny - see http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html for details.
Use either Order allow,deny or Order deny,allow (the default) - if you don't also specify both allow and deny directives, Order isn't needed.
AllowOverride can be used to control how or whether .htaccess files are interpreted, but only within <Directory> directives.
see http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride for details.
A simple example that calls the specified FastCGI program for any request to load a filename that ends in .fcgi:
allow from all
FCGIWrapper c:/usr/local/bin/TestFCGI.exe .fcgi
Please post other interesting mod_fcgid configurations here to help folks down the road.
Ivo Roper / IvoLucien