[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[fol] Re: Perl でCGIが動きません。


中江でございます。

> ファイルの転送はASCIIモードで転送はしてありました。
> サーバー側のエラーログをみると
> " /home/username/public_html/cgi-bin/.htaccess: AddType requires at least
> two arguments, a mine type followed by one or more file extensions."
> となっていました。

「AddTypeは最低2つの引数がいるんや,MIME typeは1つ以上のファイル識別子を指定
できるからな」(意訳)ですね。
.htaccessの各項目が空白で区切られてなかったとかでしょうか?

> 何度も申し訳無いのですが、最低限の何の設定を必要か教えて頂けると
> 助かります。
> よろしくお願い致します。

私も、本当の最低限は切り分けてありません。:-P
実験サーバで使っている設定を公開しましょう。
ついでにCGIの実行試験もしてみました。


[/etc/httpd/conf/access.conf]
#---------------------
ServerRoot /etc/httpd/conf/
ResourceConfig srm.conf
AccessConfig access.conf

ServerType standalone

ServerName tomcat
Port 80

ServerAdmin webmaster _at_ tomcat
DocumentRoot "/home/httpd/html/"

UserDir public_html

DefaultType text/plain
DirectoryIndex index.html index.htm index.shtml index.shtm index.cgi
AccessFileName .htaccess
ReadmeName README
HeaderName HEADER

ServerSignature  On
HostnameLookups  On
UseCanonicalName On

User  nobody
Group nobody

StartServers 5
MinSpareServers 3
MaxSpareServers 10

MaxRequestsPerChild 30

MaxClients 150

Timeout 300

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

PidFile        /var/run/httpd.pid
LockFile       /var/lock/subsys/httpd
ScoreBoardFile /var/run/apache_runtime_status

LogLevel warn
ErrorLog  /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log common
CustomLog /var/log/httpd/referer_log referer
CustomLog /var/log/httpd/agent_log agent

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent


TypesConfig /etc/httpd/conf/mime.types
<IfModule mod_mime_magic.c>
    MIMEMagicFile /etc/httpd/conf/magic
</IfModule>

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

AddEncoding x-compress Z
AddEncoding x-gzip gz

AddLanguage en .en
AddLanguage fr .fr
AddLanguage de .de
AddLanguage da .da
AddLanguage el .el
AddLanguage it .it

LanguagePriority en fr de

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
#---------------------



[/etc/httpd/conf/srm.conf]
#---------------------
#CGI
AddHandler cgi-script .cgi
AddType application/x-httpd-cgi .cgi
AddType application/x-httpd-cgi .pl

#SSI
AddHandler imap-file map
AddHandler type-map var

<Files *.log>
    Order deny,allow
    Deny from all
</Files>

<Files *.dat>
    Order deny,allow
    Deny from all
</Files>

<Files .htaccess>
    Order deny,allow
    Deny from all
</Files>
#---------------------


[/etc/httpd/conf/access.conf]
(一部編集してあります)
#---------------------
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/"
<Directory "/home/httpd/cgi-bin/">
    Options ExecCGI
    AllowOverride None
</Directory>

<Directory /home/*/public_html/>
    AllowOverride Limit AuthConfig
    Order allow,deny
    Allow from all
</Directory>

<Directory /home/*/public_html/cgi-bin/>
    AllowOverride Limit AuthConfig FileInfo
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>

<Location /cgi-bin/phf*>
    Deny from all
    ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi
</Location>
#---------------------


[/etc/httpd/conf/magic]
[/etc/httpd/conf/mime.types]
Apache1.3.9付属のまま。


CGI試験に使ったスクリプト他。
ブラウザで参照すると「hellow!」と表示します。

[/home/nakae/public_html/cgi-bin/]
-rw-r--r--   1 nakae    staff         77 Nov  1 12:28 .htaccess
-rwx---r-x   1 nakae    staff         79 Nov  1 12:31 test.cgi*

[/home/nakae/public_html/cgi-bin/.htaccess]
#---------------------
AddType  application/x-httpd-cgi  .cgi
AddType  application/x-httpd-cgi  .pl
#---------------------


[/home/nakae/public_html/cgi-bin/test.cgi]
#---------------------
#! /usr/bin/perl
print << "EOF";
Content-Type: text/html

hellow!
EOF
#---------------------

この情報があなたの探していたものかどうか選択してください。
yes/まさにこれだ!   no/違うなぁ   part/一部見つかった   try/これで試してみる

あなたが探していた情報はどのようなことか、ご自由に記入下さい。特に「まさにこれだ!」と言う場合は記入をお願いします。
例:「複数のマシンからCATV経由でipmasqueradeを利用してWebを参照したい場合の設定について」
Follow-Ups: References: