忍者ブログ

NOROMA CLUB -日記-

2016年10月15日 Raspberry Pi 設定あれこれ(Apache編)

Raspberry Pi にApacheインストールです。

Apache

・インストール
% sudo apt-get install apache2

http://localhost でサンプルページが表示されればOK。

・ユーザディレクトリ(/home/*/public_html/)にアクセスできるようにする。
% sudo /usr/sbin/a2enmod userdir
% sudo /etc/init.d/apache2 restart

・cgiを使用できるようにする
/etc/apache2/mods-available/mime.conf
の下記の行のコメントはずす。
AddHandler cgi-script .cgi

/etc/apache2/sites-available/000-default.conf
の下記の行のコメントはずす。
Include conf-available/serve-cgi-bin.conf

下記の設定ファイルをリンク。
% cd /etc/apache2/mods-enabled/
% sudo ln -s ../mods-available/cgi.load .

・ユーザディレクトリ以下のcgiを使えるようにする
/etc/apache2/conf-available/serve-cgi-bin.conf
<Directory "/usr/lib/cgi-bin">
  AllowOverride None
  Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  Require all granted
</Directory>
の下あたりに
<Directory "/home/*/public_html/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Require all granted
</Directory>
を追加。

ひととおり設定できたら、最後に再起動
% sudo /etc/init.d/apache2 restart

拍手[0回]

PR