FastCGI Apache Configuration.

Two things:

First I have the following in my http.conf:

ServerRoot "/usr/local/apache"
ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/"

<Directory /home/httpd/cgi-bin>
AllowOverride None
Options ExecCGI
</Directory>

... Bunch of Virtual Hosts ...

NameVirtualHost 192.168.0.1

<VirtualHost 192.168.0.1>
ServerName www.abc.com
ServerAlias *.abc.com www.abc.com abc.com
ServerAdmin webmaster@abc.com
DocumentRoot /home/abc/public_html
ErrorLog /var/log/httpd/abc/abc.com-error_log
TransferLog /var/log/httpd/abc/abc.com-access_log
</VirtualHost>

ErrorLog /usr/local/apache/logs/error_log

#
# To enable fast cgi:
#
<Location /cgi-bin/test1.fcgi>
SetHandler fastcgi-script
</Location>
<Location /cgi-bin/test2.fcgi>
SetHandler fastcgi-script
</Location>

FastCgiServer /home/httpd/cgi-bin/test1.fcgi -processes 5
FastCgiServer /home/httpd/cgi-bin/test2.fcgi -processes 5

As far as I can tell, that should work... there's lots of documentation, but no examples... so if you can point my in the right direction as far as the fastcgi stuff goes, I'd appreciate it.

But... in addition, this is coming up in my error log when I restart the server:

fopen: Permission denied
fcgi-: could not open error log file /var/log/httpd/abc/abc.com-error_log.
fopen: Permission denied
fcgi-: could not open error log file /var/log/httpd/abc/abc.com-error_log.
[Sat Feb  5 00:36:37 2000] [warn] FastCGI: server "/home/httpd/cgi-bin/test1.fcgi" (pid 4302) terminated by calling exit with status '1'
[Sat Feb  5 00:36:37 2000] [warn] FastCGI: server "/home/httpd/cgi-bin/test2.fcgi" (pid 4301) terminated by calling exit with status '1'


So my second question is, why is the fcgi module trying to open that particular file as its error log?  How do I stop it from trying to open that file?  What file should it be using, and how do I set it up to use that file?

I'm on a Linux box - using apache 1.3.11.  I've installed and configured fastcgi before, but it was awhile ago and what I've remembered doesn't seem to apply these days...  So any help would be greatly appreciated.
LVL 2
helverAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jlevieCommented:
I've looked at this off and on all afternoon and I just figured out what's been bothering me about the config. Your definition of the cgi-bin doesn't include an "Options ExecCGI", which according to the docs is required. Also I don't see where you've added a handler for .fcgi's, usually something like: "AddHandler fastcgi-script .fcgi .fcg .fpl", although it might be elsewhere in the config.
0
helverAuthor Commented:
My apologies:

The following lines are also contained in the httpd.conf file:

<Directory /home/httpd/cgi-bin>
AllowOverride None
Options ExecCGI
</Directory>


Additionally, it was my understanding that a SetHandler rule could be applied to a particular thing in place of adding a global AddHandler.  But I'll try adding the AddHandler and see what happens...
0
helverAuthor Commented:
Edited text of question.
0
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

helverAuthor Commented:
The AddHandler directive did not seem to have any effect.  As the portion of the log shows, the fastcgi module is finding the two scripts and attempting to run them.  So I'm pretty sure that at least that part is working... it's just that it's trying to open a log file that it can't... I'm not sure why it can't, and why it's trying to open that particular file...
0
jlevieCommented:
As to the ExecCGI, the docs seem to me to imply that it has to be done at the same level as the SetHandler fastcgi-script.

As to the log files, I noticed that and don't have an explanation. I wonder if it could be an artifact of another error and simply using those as they were the last opened when the error occured.

Do you have any servers configured at the global level, or are they all virtual hosts?
0
jlevieCommented:
Oh, I just found something of an example in the OpenSource99 presentation on the Fast-CGI site (www.fastcgi.com/OpenSource99/FastCGI_files/v3_document.htm).
0
helverAuthor Commented:
I looked at that... and while it had some directives that I wasn't using, the overall effect has not changed... my logs are still getting spammed by the processes attempting to restart, and fcgi attempting to open the error log file of one of my virtual servers...
0
helverAuthor Commented:
Adjusted points to 1000
0
ahoffmannCommented:
are you using CGI::Fast or FCGI.pm or the perl-savvy, probably the pre-compiled from fastserv.com ?

> why is the fcgi module trying to open that particular file
see the fastserv.conf file in your apache config directory
0
helverAuthor Commented:
FCGI.pm...

And therefore I don't have a fastserv.conf file in the config directory.
0
jlevieCommented:
Could it be that the FastCGI needs to be able to open all of the error logs and fails on this one only because of a permissions problem. Since it's defined at the global level it would seem that it would need to log to any of the virtual server's logs.
0
helverAuthor Commented:
I thought about that... so I

1) verified that the permissions for that log file were correct - and they were.

2) I swapped some of my virtualhost entries around so that a different one was last... the one that was last was always the one with the problem.  Even if it was def.com, or ghi.org.  *sigh*

What's really frustrating is that I'm just not finding any examples for configuring FastCGI with the new version of mod_fastcgi.  Almost everything I've found is for the older version with the AppClass directive, etc.
0
jlevieCommented:
The file permissions thing was a long shot, but worth mentioning. I've sortof suspected all all along that it was trying to ope the last log files used, and you've confirmed that.

Okay, just for you (and because I have this character flaw that won't allow me to let go of a problem like this..) I'm going to build an Apache server this evening on a Redhat box with FastCGI support and figure out whats going on.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
helverAuthor Commented:
Well at this point, I'll take any help I can get.  I've been dorking around with this for almost a week and would welcome any insights you can bring...
0
helverAuthor Commented:
Guess what?

I started playing around with it again and just removed all the Virtual Hosts... and what that did was show me that I was getting an error code '9', which means that the thing wasn't compiling properly.

*sigh*

So by commenting out the VirtualHosts, the mod_fastcgi finally gave me error messages related to the actual problem.

Anyways... thanks for your help...

0
jlevieCommented:
I'd already started what I had said that I would do when I saw you'd marked the question as "answered", but I have found out a bit more.

For some reason (I haven't delved into the source yet) it looks like that kind of failure tries to use the last log file from the last virtual host. Now that I think about it, I vaguely recall seeing some admonition (that I can't seem to find at the moment) that said to always put all global commands before the virtual host directives. Perhaps this sort of problem is the reason one should do so.

Have you gotten it working yet?
0
helverAuthor Commented:
Yeah... It seems to be doing alot better at the moment... the only problems I can see are ones of my own creation.  And Im more than willing to spend the time to fix those ones...

About the "before the virtual hosts" thing... I believe that initially my FastCgi directives were before any of the virtual hosts...  I moved them down to the bottom after I had my initial round of problems...  strange... anyways... thanks for you assistance.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking

From novice to tech pro — start learning today.