YanoRyuichi.com/
Wiki
Blog
GitHub
Sandbox
開始行:
* FastCGI環境でのFCGIスクリプトの実行 [#e9ee6e7d]
** 前提 [#nf83d080]
- ウェブサーバはApacheとし、FastCGI環境はmod_fastcgiによ...
- mod_fastcgiによるFCGIスクリプトの実行は、ダイナミック、...
- 以下はそれぞれの場合における、Apacheの設定とFCGIスクリ...
- FCGIスクリプト count.fcgi(count.pl)は、ブラウザでアクセ...
** ダイナミック [#rdb92624]
*** httpd.conf [#x9a2800f]
必要に応じて FastCgiConfig にてパラメータを指定する。ウェ...
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script fcgi
# FastCgiConfig
</IfModule>
<VirtualHost *:80>
ServerAdmin root@localhost
ServerName 192.168.0.100
DocumentRoot /home/www/htdocs
ErrorLog /home/www/logs/error_log
CustomLog /home/www/logs/access_log common
<Directory />
Order Deny,Allow
Allow from All
Options All
AllowOverride All
</Directory>
</VirtualHost>
*** count.fcgi [#fa6a8ca4]
#!/usr/local/bin/perl
use FCGI;
my $request = FCGI::Request();
my $count = 0;
while ( $request->Accept() >= 0 ) {
print "content-type: text/html\r\n\r\n";
print ++$count;
}
** スタティック[#a8f33dad]
*** httpd.conf [#v7e18d4b]
ウェブサーバ(再)起動時にcount.fcgiは起動される。
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script fcgi
FastCgiServer /home/www/cgi-bin/count.fcgi -processes 3
</IfModule>
*** count.fcgi [#a0dda575]
スクリプトの内容は上と同じ。
** 外部サーバ [#y182b7ea]
UNIXドメインソケットを使って、外部FCGIスクリプトサーバと...
*** httpd.conf[#u5bdfc97]
FastCgiExternalServerを指定する。
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script fcgi
FastCgiExternalServer /home/www/htdocs/count.fcgi -so...
</IfModule>
(略)
*** count.pl [#t1415557]
#!/usr/local/bin/perl
use FCGI;
umask 000;
my $socket = FCGI::OpenSocket( "/tmp/fastcgi.socket", 5 );
my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR...
my $count = 0;
while ( $request->Accept() >= 0 ) {
print "content-type: text/html\r\n\r\n";
print ++$count;
}
FCGI::CloseSocket($socket);
*** 説明 [#c0037e44]
まずシェルからcount.plを起動する(count.plの設置場所はど...
count.fcgiはファイルとして存在しない。実際には、ソケット...
また、UNIXドメインソケットでなく、TCPポートを使って通信す...
FastCgiExternalServer /home/www/htdocs/count.fcgi -host ...
my $socket = FCGI::OpenSocket( ":8000", 5 );
** 参考 [#o2c3538a]
http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html
終了行:
* FastCGI環境でのFCGIスクリプトの実行 [#e9ee6e7d]
** 前提 [#nf83d080]
- ウェブサーバはApacheとし、FastCGI環境はmod_fastcgiによ...
- mod_fastcgiによるFCGIスクリプトの実行は、ダイナミック、...
- 以下はそれぞれの場合における、Apacheの設定とFCGIスクリ...
- FCGIスクリプト count.fcgi(count.pl)は、ブラウザでアクセ...
** ダイナミック [#rdb92624]
*** httpd.conf [#x9a2800f]
必要に応じて FastCgiConfig にてパラメータを指定する。ウェ...
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script fcgi
# FastCgiConfig
</IfModule>
<VirtualHost *:80>
ServerAdmin root@localhost
ServerName 192.168.0.100
DocumentRoot /home/www/htdocs
ErrorLog /home/www/logs/error_log
CustomLog /home/www/logs/access_log common
<Directory />
Order Deny,Allow
Allow from All
Options All
AllowOverride All
</Directory>
</VirtualHost>
*** count.fcgi [#fa6a8ca4]
#!/usr/local/bin/perl
use FCGI;
my $request = FCGI::Request();
my $count = 0;
while ( $request->Accept() >= 0 ) {
print "content-type: text/html\r\n\r\n";
print ++$count;
}
** スタティック[#a8f33dad]
*** httpd.conf [#v7e18d4b]
ウェブサーバ(再)起動時にcount.fcgiは起動される。
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script fcgi
FastCgiServer /home/www/cgi-bin/count.fcgi -processes 3
</IfModule>
*** count.fcgi [#a0dda575]
スクリプトの内容は上と同じ。
** 外部サーバ [#y182b7ea]
UNIXドメインソケットを使って、外部FCGIスクリプトサーバと...
*** httpd.conf[#u5bdfc97]
FastCgiExternalServerを指定する。
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script fcgi
FastCgiExternalServer /home/www/htdocs/count.fcgi -so...
</IfModule>
(略)
*** count.pl [#t1415557]
#!/usr/local/bin/perl
use FCGI;
umask 000;
my $socket = FCGI::OpenSocket( "/tmp/fastcgi.socket", 5 );
my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR...
my $count = 0;
while ( $request->Accept() >= 0 ) {
print "content-type: text/html\r\n\r\n";
print ++$count;
}
FCGI::CloseSocket($socket);
*** 説明 [#c0037e44]
まずシェルからcount.plを起動する(count.plの設置場所はど...
count.fcgiはファイルとして存在しない。実際には、ソケット...
また、UNIXドメインソケットでなく、TCPポートを使って通信す...
FastCgiExternalServer /home/www/htdocs/count.fcgi -host ...
my $socket = FCGI::OpenSocket( ":8000", 5 );
** 参考 [#o2c3538a]
http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html
ページ名: