Recent

Author Topic: configure FastCGI of fpWeb  (Read 40011 times)

kodok_buncit

  • New Member
  • *
  • Posts: 33
    • fajardelphiscript
Re: configure FastCGI of fpWeb
« Reply #15 on: April 24, 2011, 09:08:45 pm »
I get this error when restarting apache:
Code: [Select]
Invalid command 'FastCgiExternalServer', perhaps misspelled or defined by a module not included in the server configuration

as I said before we use a different module,so the configuration is also different
mod_fcgi and mod_fcgid is also different

read this for reference http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html

My big challenge now is to run Hello world Fast CGI.I think this configuration takes time more than understanding and testing successfully CGI protocol before developing FreeSpider
haha..dont worry we will help you.
Peace and blessings be upon you all

bobo

  • Full Member
  • ***
  • Posts: 171
Re: configure FastCGI of fpWeb
« Reply #16 on: May 17, 2011, 05:59:35 am »
To compile the FCGI module on Ubuntu Linux, here are the steps:
(Note, this is NOT the mod_fcgid module that comes with apache or with the distribution you have but compiled directly from the fascgi.com website sources)

Code: [Select]
1. if the Apache development package is not installed, then:
sudo apt-get install apache2-dev

2. get the fcgi module sources (get the latest SNAP or highest version stable release from http://www.fastcgi.com/dist/)
wget http://www.fastcgi.com/dist/mod_fastcgi-...tar.gz

3. unpack them
tar -xzf mod_fastcgi-...tar.gz

4. configure the makefile
cd mod_fastcgi-*
cp Makefile.AP2 Makefile

#edit the copied Makefile and set top_dir to the proper apache source dir (/usr/share/apache2 for Ubuntu containing the .mk file)

5. compile and install
make
sudo make install

#now we should have a mod_fastcgi.so in /usr/lib/apache2/modules

6. configure Apache2
#put in the Apache2 conf file (/etc/apache2/apache2.conf on Ubuntu):

LoadModule fastcgi_module "/usr/lib/apache2/modules/mod_fastcgi.so"
<IfModule mod_fastcgi.c>
 #Needs full paths
 AddHandler fastcgi-script .fcgi
 ScriptAlias /myfcgi "/path_to/your_fcgi"
 FastCgiExternalServer "/path_to/your_fcgi" -host 127.0.0.1:2015 -idle-timeout 30 -flush
</IfModule>

7. restart apache2
« Last Edit: May 17, 2011, 06:01:28 am by bobo »

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: configure FastCGI of fpWeb
« Reply #17 on: May 17, 2011, 06:47:59 am »
I've done all that steps successfully, and apache2 has restarted.
This is my configuration:

Code: [Select]
LoadModule fastcgi_module "/usr/lib/apache2/modules/mod_fastcgi.so"
<IfModule mod_fastcgi.c>
 #Needs full paths
 AddHandler fastcgi-script .fcgi
 ScriptAlias /myfcgi "/home/motaz/projects/ffcgi/ffcgi"
 FastCgiExternalServer "/home/motaz/projects/ffcgi/ffcgi" -host 127.0.0.1:9090 -idle-timeout 30 -flush
</IfModule>

When I tried to access it from firefox using: http://localhost/myfcgi/test or http://localhost/myfcgi/ it gives me:

Code: [Select]
Forbidden

You don't have permission to access /myfcgi/test on this server.
Apache/2.2.16 (Ubuntu) Server at localhost Port 80


bobo

  • Full Member
  • ***
  • Posts: 171
Re: configure FastCGI of fpWeb
« Reply #18 on: May 17, 2011, 07:18:19 am »
That is just some Apache configuration or Linux access rights problem.

You could try to move the fcgi program to the /usr/lib/cgi-bin/ directory and make it readable and executable to everyone, then update the paths in the Apache conf file.

Or, maybe /home/motaz/projects/ffcgi/  is not allowed in the Apache config to execute scripts.
You could try to add to the apache conf file something like:
<Directory "/home/motaz/projects/ffcgi">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

not sure.

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: configure FastCGI of fpWeb
« Reply #19 on: May 17, 2011, 08:07:58 am »
- I've changed befor permission of /home/motaz/projects/ffcgi folder to 777
- Adding Directory configuration does not solve it
- I copied ffcgi to /usr/lib/cgi-bin and run it, but it gives the same permission denied error
- Normal CGI applications running fine in /usr/lib/cgi-bin directory



bobo

  • Full Member
  • ***
  • Posts: 171
Re: configure FastCGI of fpWeb
« Reply #20 on: May 17, 2011, 10:37:35 am »
Try to give .fcgi extension to your fcgi program -> /home/motaz/projects/ffcgi/ffcgi.fcgi

It is working on my Linux without all these, but theoretically
AddHandler fastcgi-script .fcgi
defines it that way.

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: configure FastCGI of fpWeb
« Reply #21 on: May 17, 2011, 05:05:13 pm »
still not working.

This is the source of my application it might help

bobo

  • Full Member
  • ***
  • Posts: 171
Re: configure FastCGI of fpWeb
« Reply #22 on: May 18, 2011, 12:56:55 am »
motaz, it is not your application that is the problem (BTW, it works here),  it is a configuration problem on your computer.

Are you sure the fcgi module is loaded into Apache? Do you see it in your Apache response headers?
something like "Apache/2.2.9 (blahblah) PHP/5.3.1 mod_fastcgi/2.4.6"

Comment out the <IfModule and </IfModule lines to be sure.
« Last Edit: May 18, 2011, 01:01:43 am by bobo »

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: configure FastCGI of fpWeb
« Reply #23 on: May 18, 2011, 06:05:58 pm »
I've checked the module file and it is exist:

-rwxrwxrwx 1 root root 96735 2011-05-17 07:33 /usr/lib/apache2/modules/mod_fastcgi.so

When I comment <ifmodule.. , apache has restarted successfully, but when I comment load module line, I get not found instead of forbidden

How can I read the headers?

bobo

  • Full Member
  • ***
  • Posts: 171
Re: configure FastCGI of fpWeb
« Reply #24 on: May 18, 2011, 08:33:18 pm »
To see any web page response headers from a web server, I use the FireBug Firefox Addon (it can show the HTML response from a web server among a ton of other things).

Tried to add
Code: [Select]
Options +ExecCGI
into the apache conf <Directory...> instructions?

For example:
Code: [Select]
<Directory "/home/motaz/projects/ffcgi">
    Options +ExecCGI
    Order allow,deny
    Allow from all
</Directory>
« Last Edit: May 18, 2011, 08:44:41 pm by bobo »

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: configure FastCGI of fpWeb
« Reply #25 on: May 19, 2011, 08:15:27 am »
it is still forbidden, could you please send to me your apache2.conf

bobo

  • Full Member
  • ***
  • Posts: 171
Re: configure FastCGI of fpWeb
« Reply #26 on: May 19, 2011, 09:46:41 am »
I am not sure it will help much, but attached both Windows and Linux conf...

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: configure FastCGI of fpWeb
« Reply #27 on: May 19, 2011, 05:32:23 pm »
It is almost the same configuration.

If I were a web server I would not care about fast CGI executable file directory and path, I would care about socket only.

when I connect to fast CGI application using telnet localhost 9090 and typed GET HTTP 1.1 I get this resposne when means that the Fast CGI application is running:

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>Topic Related Searching at HTTP.COM.</title>
<meta  name="description" content="Hypertext Transfer Protocol - Topic Related Searching (TRS)" />
<meta  name="keywords" content="http, hypertext, hypertext transfer protocol, topic related searching, trs, http.com, sponsored search results" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<frameset rows="*,0" frameborder="NO" border="0" framespacing="0">
  <frame name="mainFrame" src="http://domains.googlesyndication.com/apps/domainpark/domainpark.cgi?cid=ca-dp-og03&s=HTTP.com">
</frameset>
<noframes>
<body bgcolor="#FFFFFF">
Please visit <a href="http://domains.googlesyndication.com/apps/domainpark/domainpark.cgi?cid=ca-dp-og03&s=HTTP.com">this link</a> since your browser does not support frames.
</body>
</noframes>
</html>

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: configure FastCGI of fpWeb
« Reply #28 on: May 19, 2011, 05:55:45 pm »
It works !!

I have created an empty directory in /var/www/fcgi
and I run my Fast CGI application from /home/motaz/ffcgi
and I've changed the configuration to:

Code: [Select]
<IfModule mod_fastcgi.c>
 #Needs full paths
 AddHandler fastcgi-script .fcgi
 ScriptAlias /myfcgi "/var/www/fcgi"
 FastCgiExternalServer "/var/www/fcgi" -host 127.0.0.1:9090 -idle-timeout 30 -flush
</IfModule>

but I got only the default action handler, if I typed http://localhost/myfcgi or http://localhost/myfcgi/test or http://localhost/myfcgi/action1 I got the same :

This is my hello world CGI application

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: configure FastCGI of fpWeb
« Reply #29 on: May 19, 2011, 06:05:23 pm »
Could you please post here your Fast CGI code with multiple actions.
thanks

 

TinyPortal © 2005-2018