また、自作かよ。(CGI 編)-02

By | 2020年7月2日

httpd.conf を編集します。

[*****Server ~]# cd /etc/httpd/conf
[*****Server conf]# vi httpd.conf

# Further relax access to the default document root:
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* — "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks
Options +ExecCGI  ←行を追加

#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
AllowOverride None
Options ExecCGI  ← Options None から変更
Require all granted
</Directory>

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl  ← # を外して、 .pl も追加

CGI を動作させるために必要な編集は以上ですが、

私の場合は、 .htaccess も使うので

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All  ← AllowOverride None から変更

とします。

# systemctl restart httpd

httpd を再起動。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

日本語を使って書いてね。外国語わかんない。