MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment

  • mod_fcgid

mod_fcgid

  • https://httpd.apache.org/mod_fcgid/

mod_fcgid is a high performance alternative to mod_cgi or mod_cgid, which starts a sufficient number instances of the CGI program to handle concurrent requests, and these programs remain running to handle further incoming requests.

   1 wget http://mirrors.up.pt/pub/apache//httpd/mod_fcgid/mod_fcgid-2.3.9.tar.bz2
   2 tar xvif mod_fcgid-2.3.9.tar.bz2 
   3 cd mod_fcgid-2.3.9
   4 ./configure.apxs 
   5 make
   6 make install
   7 /usr/lib/httpd/modules/mod_fcgid.so
   8 # /etc/httpd/httpd.conf
   9 # LoadModule fcgid_module lib/httpd/modules/mod_fcgid.so
  10 

fcgi library

  • https://opensource.apple.com/source/FastCGI/FastCGI-4/fcgi/doc/fastcgi-whitepaper/fastcgi.htm

  • https://opensource.apple.com/source/FastCGI/FastCGI-4/fcgi/doc/fcgi-spec.html#S2

The key piece of initial state in a FastCGI process is a listening socket, through which it accepts connections from a Web server. A FastCGI application calls accept() on the socket referred to by file descriptor FCGI_LISTENSOCK_FILENO to accept a new transport connection.

  • man 2 getpeername

GETPEERNAME(2)             Linux Programmer's Manual            GETPEERNAME(2)
NAME
       getpeername - get name of connected peer socket
SYNOPSIS
       #include <sys/socket.h>
       int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);

   1 cd /tmp/
   2 wget https://slackbuilds.org/slackbuilds/14.2/libraries/fcgi.tar.gz
   3 tar xvzf fcgi.tar.gz 
   4 cd fcgi
   5 wget https://sourceforge.net/projects/slackbuildsdirectlinks/files/fcgi/fcgi-2.4.0.tar.gz
   6 ./fcgi.SlackBuild 
   7 installpkg  /tmp/fcgi-2.4.0-i486-1_SBo.tgz

fcgi_app.c

   1 /*compile:  cc fcgi_app.c -o fcgi_app -lfcgi */
   2 /* /usr/lib/libfcgi.so */
   3 /* cp /tmp/fcgi_app /var/www/htdocs/localhostfcgi/app.fcgi */
   4 
   5 #include <fcgi_stdio.h>
   6 void main(void)
   7 {
   8     int count = 0;
   9     while(FCGI_Accept() >= 0) {
  10         printf("Content-type: text/html\r\n");
  11         printf("\r\n");
  12         printf("Hello world!<br>\r\n");
  13         printf("Request number %d.", count++);
  14     }
  15     exit(0);
  16 }

/etc/httpd/vhosts.conf

  • http://localhostfcgi/app.fcgi

   1 <VirtualHost *:80>
   2     ServerName localhostfcgi
   3     FcgidInitialEnv name value 
   4     DocumentRoot "/var/www/htdocs/localhostfcgi"
   5     ScriptAlias / /var/www/htdocs/localhostfcgi/
   6     <Directory "/var/www/htdocs/localhostfcgi">
   7         Options +ExecCGI
   8         Require local
   9     </Directory>
  10 </VirtualHost>

/etc/httpd/httpd.conf

LoadModule fcgid_module lib/httpd/modules/mod_fcgid.so
SetHandler fcgid-script
Options +ExecCGI

   1 lsof | grep -i fcgi
   2 #app.fcgi  9803          apache    0u     unix 0xe1dff440      0t0      59138 /var/run/fcgidsock/4840.1 type=STREAM
   3 
   4 netstat -a -n | grep fcgi
   5 #Active UNIX domain sockets (servers and established)
   6 #Proto RefCnt Flags       Type       State         I-Node   Path
   7 #unix  2      [ ACC ]     STREAM     LISTENING     59138    /var/run/fcgidsock/4840.1
   8 
   9 lsof | grep -i fcgidsock
  10 #app.fcgi   9803           apache    0u     unix 0xe1dff440      0t0      59138 /var/run/fcgidsock/4840.1 type=STREAM
  11 #x.fcgi    10044           apache    0u     unix 0xe1dff700      0t0     108605 /var/run/fcgidsock/4840.7 type=STREAM
  12 
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01