1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Apache2 で perl の CGI を使えるようにする

Last updated at Posted at 2020-06-20

Ubuntu 20.04 で確認しました。
次の記事を参考にしました。
https://pentan.info/server/apache_cgi.html

次のファイルを作成

/etc/apache2/conf-available/cgi-enabled.conf
<Directory "/var/www/html/public_html">
    Options +ExecCGI
    AddHandler cgi-script .cgi .pl
</Directory>

次のコマンドで変更を反映

sudo a2enconf cgi-enabled
sudo a2enmod cgi
sudo systemctl restart apache2

任意の場所でスクリプトを動かす為には、次のようにする必要がある。

/etc/apache2/conf-available/serve-cgi-bin.conf
<IfModule mod_alias.c>
	<IfModule mod_cgi.c>
		Define ENABLE_USR_LIB_CGI_BIN
	</IfModule>

	<IfModule mod_cgid.c>
		Define ENABLE_USR_LIB_CGI_BIN
	</IfModule>

#	<IfDefine ENABLE_USR_LIB_CGI_BIN>
#		ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
#		<Directory "/usr/lib/cgi-bin">
#			AllowOverride None
#			Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
#			Require all granted
#		</Directory>
#	</IfDefine>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?