Question about fastcgi

Hi, I'm learnng to use fastcgi and, reading the examples, I see the main "loop" is like this: main = runFastCGI my_work However, isn't a fastcgi program supposed to choose a port where to listen to calls? For instance, in this C example: xzdev.com/nginx_fastcgi.html doesn't the line listen_socket = FCGX_OpenSocket(":8002", 2000); says it's listening to port 8002? I read the code for fastcgi, from hackage, and I can't find anything related to ports like, for instance, a default port. Am I understanding something the wrong way? Thanks, Maurício

Er, no. A fastcgi executable is (like a cgi executable) controlled by the front end web server. I run my fastcgi using Apache as the front end. The front end web server will control things like the port number. Mauricio wrote:
Hi,
I'm learnng to use fastcgi and, reading the examples, I see the main "loop" is like this:
main = runFastCGI my_work
However, isn't a fastcgi program supposed to choose a port where to listen to calls? For instance, in this C example:
xzdev.com/nginx_fastcgi.html
doesn't the line
listen_socket = FCGX_OpenSocket(":8002", 2000);
says it's listening to port 8002? I read the code for fastcgi, from hackage, and I can't find anything related to ports like, for instance, a default port. Am I understanding something the wrong way?
Thanks, Maurício

"ChrisK" == ChrisK
writes:
ChrisK> Er, no. A fastcgi executable is (like a cgi executable) ChrisK> controlled by the front end web server. I run my fastcgi ChrisK> using Apache as the front end. The front end web server ChrisK> will control things like the port number. There are different ways to run a FasctCGI executable (three if my memory serves me correctly). I have only ever written FasctCGI executables (not in Haskell) when the server accepts a port number at start up, and is started independently of Apache (or whatever). And Apache is told which port numbers it will find the servers on. ChrisK> Mauricio wrote: >> Hi, >> >> I'm learnng to use fastcgi and, reading the examples, I see the >> main "loop" is like this: >> >> main = runFastCGI my_work >> >> However, isn't a fastcgi program supposed to choose a port >> where to listen to calls? For instance, in this C example: >> >> xzdev.com/nginx_fastcgi.html >> >> doesn't the line >> >> listen_socket = FCGX_OpenSocket(":8002", 2000); >> >> says it's listening to port 8002? I read the code for fastcgi, >> from hackage, and I can't find anything related to ports like, >> for instance, a default port. Am I understanding something the >> wrong way? >> >> Thanks, Maurício -- Colin Adams Preston Lancashire

I have only used this, all of these are from Haskell:
pamac-cek10:~ chrisk$ cat /etc/apache2/other/httpd-fastcgi.conf <IfModule mod_fastcgi.c> Alias /fcgi-bin/ "/Library/WebServer/FastCGI-Executables/"
AllowOverride None Options None Order allow,deny Allow from all SetHandler fastcgi-script Options +ExecCGI </Directory>
FastCgiIpcDir "/tmp/fastcgi" FastCgiServer "/Library/WebServer/FastCGI-Executables/hw.fastcgi" -pass-header Cookie FastCgiServer "/Library/WebServer/FastCGI-Executables/test.fastcgi" -pass-header Cookie FastCgiServer "/Library/WebServer/FastCGI-Executables/xwords.fastcgi" -pass-header Cookie </IfModule>
The above is included from the main httpd.conf which has:
pamac-cek10:~ chrisk$ grep -i fast /etc/apache2/httpd.conf LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so

I was able to get this working with lighttpd, and I did had to choose a port, but only at lighttpd configuration, not at the Haskell source. Thanks, Maurício ChrisK a écrit :
I have only used this, all of these are from Haskell:
pamac-cek10:~ chrisk$ cat /etc/apache2/other/httpd-fastcgi.conf <IfModule mod_fastcgi.c> Alias /fcgi-bin/ "/Library/WebServer/FastCGI-Executables/"
AllowOverride None Options None Order allow,deny Allow from all SetHandler fastcgi-script Options +ExecCGI </Directory>
FastCgiIpcDir "/tmp/fastcgi" FastCgiServer "/Library/WebServer/FastCGI-Executables/hw.fastcgi" -pass-header Cookie FastCgiServer "/Library/WebServer/FastCGI-Executables/test.fastcgi" -pass-header Cookie FastCgiServer "/Library/WebServer/FastCGI-Executables/xwords.fastcgi" -pass-header Cookie </IfModule>
The above is included from the main httpd.conf which has:
pamac-cek10:~ chrisk$ grep -i fast /etc/apache2/httpd.conf LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so
participants (3)
-
ChrisK
-
Colin Paul Adams
-
Mauricio