13,005
回編集
21行目: | 21行目: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br> | <br> | ||
Webブラウザに、http://localhost と入力する。<br> | |||
"Welcome to SUSE Web Site" | "Welcome to SUSE Web Site"と記載されたWebページが表示されれば、Apache2のインストールは完了である。<br> | ||
<br><br> | |||
== CGIの設定 == | |||
まず、/etc/apache2/default-server.confファイルに以下の赤字の設定を追記する。<br> | |||
# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased | |||
# CGI directory exists, if you have that configured. | |||
# | |||
<Directory "/srv/www/cgi-bin"> | |||
AllowOverride None | |||
Options +ExecCGI -Includes | |||
<span style="color:#C00000">AddHandler cgi-script .cgi .pl</span> | |||
<IfModule !mod_access_compat.c> | |||
Require all granted | |||
</IfModule> | |||
<IfModule mod_access_compat.c> | |||
Order allow,deny | |||
Allow from all | |||
</IfModule> | |||
</Directory> | |||
<br> | <br> | ||
上記の設定を反映させるため、Apache2を再起動する。<br> | |||
sudo systemctl restart apache2 | |||
<br> | |||
次に、test1.cgiファイルを作成して表示する。<br> | |||
test1.cgiファイルの内容は、以下の通りである。<br> | |||
以下の例では、CGIファイルのディレクトリのパスは、/srv/www/cgi-bin/である。<br> | |||
sudo vi /srv/www/cgi-bin/test1.cgi | sudo vi /srv/www/cgi-bin/test1.cgi | ||
<br> | <br> |