Install FastCGI on Unix/Linux

Source: Internet
Author: User
Installing FastCGI in Unix/Linux is complicated. Now let's talk about FastCGI installation in Unix/Linux, Perl, and Apache server environments. FCGI modules in Apache: 1. download http://www.fastcgi.com/dist/mod_fastcgi.tar.gz2?decompress Apache to install FastCGI in Unix/Linux. Now let's talk about FastCGI installation in Unix/Linux, Perl, and Apache server environments.

FCGI modules in Apache:
1. download http://www.fastcgi.com/dist/mod_fastcgi.tar.gz


2. decompress the apache installation file. Decompress the fastcgi installation file to/src/modules/fas under apache.
Tcgi Directory
3. set Apache to add the mod_fastcgi module:
./Configure -- activate-module = src/modules/fastcgi/libfastcgi. a -- enabl
E-module = info -- enable-shared = info
4. compilation and installation
$ Make
$ Make install
5. check whether the compiled execution file contains the mod_fastcgi module:
$ Apacherunpath/httpd-l
Compiled-in modules:
Http_core.c
...
Mod_fastcgi.c
...
6. add relevant settings for using mod_fastcgi www.linuxidc.com
Edit httpd. conf and add AddHandler fastcgi-script. fcg. fpl.
Create the youwwwpath/fcgi-bin directory and set the/fcgi-bin/directory to indicate youwwwpath/fcgi-bin.
/Add ScriptAlias/fcgi-bin // usr/local/www/fcgi-bin/to httpd. conf/
7. check for syntax errors
$/Apachepath/apachectl configtest
Syntax OK -- System Display
8. reactivate the Apache server to make the new settings take effect:
$/Usr/local/apache/sbin/apachectl graceful
/Usr/local/apache/bin/apachectl graceful: httpd gracefully restarted
-- System Display


FCGI module of PERL:
1. First, we install the FastCGI module in Perl. The latest version in http://www.fastcgi.com
.
Latest: FCGI-0.56.tar.gz
2. download FCGI-0.45.tar.gz and unlock
$ Gunzip-c FCGI-0.56.tar.gz | tar xvf-
3. compilation and installation
$ Perl Makefile. PL
$ Make
$ Make install
4. test
$ Cp echo. fpl {directory where Fastcgi is located in your www}
$ Lynx {echo. fpl address in your www}

If it succeeds, the following results will be displayed:
FastCGI echo (Perl)
Request number 1
No data from standard input.
Request environment:

DOCUMENT_ROOT =/usr/local/apache/htdocs
FCGI_ROLE = RESPONDER
GATEWAY_INTERFACE = CGI/1.1.
HTTP_ACCEPT = text/html, text/plain, application/applefile, application/
X-metamai
L-patch, sun-configured set-message, mail-file, default, postscript-file, aud
Io-file,
X-sun-attachment, text/enriched, text/richtext, application/andrew-ins
Et, x-be2
, Application/postscript, message/external-body, message/partial, appl
Ication/p
Gp, application/pgp, video/mpeg, video/*, image/*, audio/*, audio/mod,
Text/sgm
L, video/mpeg, image/jpeg, image/tiff, image/x-rgb, image/png, image/x
-Xbitmap,
Image/x-xbm, image/gif, application/postscript, */*; q = 0.01
HTTP_ACCEPT_ENCODING = gzip, compress
HTTP_ACCEPT_LANGUAGE = en
HTTP_HOST = localhost
HTTP_NEGOTIATE = trans
HTTP_USER_AGENT = Lynx/2.8.1pre.9 libwww-FM/2.14
PATH =/usr/local/bin:/usr/X11R6/bin:/usr/sbin:/opt/kde/bi
N:/home/m
Yhsu/bin:/usr/X11R6/bin:/usr/sbin:/opt/kde/bin:/usr/X11R6/bin:/usr/sbi
N:/opt/kd
E/bin
QUERY_STRING =
REMOTE_ADDR = 127.0.0.1
REMOTE_PORT = 1427
REQUEST_METHOD = GET
REQUEST_URI =/fcgi-bin/echo. fpl
SCRIPT_FILENAME =/usr/local/www/fcgi-bin/echo. fpl
SCRIPT_NAME =/fcgi-bin/echo. fpl
SERVER_ADMIN = myhsu@localhost.localdomain
SERVER_NAME = localhost. localdomain
SERVER_PORT = 80
SERVER_PROTOCOL = HTTP/1.0
SERVER_SIGNATURE =

Apache/1.3.6 Server at localhost. localdomain Port 80
SERVER_SOFTWARE = Apache/1.3.6 (Unix) mod_fastcgi/2.2.2
UNIQUE_ID = N1VIbX8AAAEAAAQnKKo
More on its way... wait a few seconds
Initial environment:

Finally, we will give you an example of fastcgi programming:
#! /Usr/local/bin/perl
Use CGI: Fast;

My $ counter = 0;

While (my $ cgi = new CGI: Fast ){
Print ("Content-type: text/html ");
Print ("We have served $ counter requests ");
$ Counter ++;
}


That's all,
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.