LoginSignup
9
9

More than 5 years have passed since last update.

Ubuntu14.04にPukiwiki1.5.0をインストールする

Last updated at Posted at 2015-02-22

Ubuntu14.04に、Apache2.40とPHP、およびPukiwikiをインストールし、Basic認証するところまで。

Apache2.4とPHPのインストール

まずは普通に、apt-getする。

$ sudo apt-get install apache2
$ sudo apt-get install php5

/var/www/html がデフォルトのパブリックフォルダとなっている。apt-getでインストール後は、自動的にサーバプロセスが起動する。
ブラウザで、

http://[サーバー名]/

へアクセスし、Apacheのデフォルトページが表示されればOK

Pukiwiki1.5.0を設置

utf8版のPukiwiki1.5.0を使う。WikiのURLは、http://[サーバ名]/wiki とする。
zipファイルなので、まずUnzipをインストールする。

$ sudo apt-get install unzip
$ cd /var/www/html
$ sudo unzip pukiwiki-1_5_0_utf8.zip
$ sudo mv pukiwiki-1_5_0_utf8 wiki

Wikiの実行権限をサーバプロセスと同じ、www-dataにする。

$ chown -R www-data.www-data /var/www/html/wiki

これで、http://[サーバ名]/wiki にアクセスし、PukiwikiのデフォルトのFrontPageが表示される。

PukiwikiをBASIC認証対応にする。

htpasswdで個別にパスワードファイルを設置する。htpasswdを使うため、apache2-utilパッケージをインストールする。

$ sudo apt-get install apache2-utils

パスワードファイルは、/etc/apache2 直下に置くこととする。

$ cd /etc/apache2
$ sudo htpasswd -c [ユーザ名]

Pukiwiki内の.htaccessの設定

Apache2.4では、.htaccessの書式が以前と少し異なっているため、注意が必要。
アクセス制御の書式を以下のように変更する。

変更前

<FilesMatch "\.(ini\.php|lng\.php|txt|gz|tgz|zip)$">
    Order allow,deny
    Deny from all
</FilesMatch>

変更後

<FilesMatch "\.(ini\.php|lng\.php|txt|gz|tgz|zip)$">
    Require all denied
</FilesMatch>

最後に、BASIC認証有効化のため、以下の4行のコメントアウトを解除する。AuthUserFileのパスは、適切に修正すること。

AuthType Basic
AuthName      "Authentication required"
AuthUserFile  /etc/apache2/.htpasswd
Require       valid-user

Apache2.confの修正

オーバーライドの設定有効化を行う。BASIC認証とは関係ないが、Indexesオプションの無効化も合わせてやっている。

変更前

<Directory /var/www>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

変更後

<Directory /var/www>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

修正完了後、ApacheをリスタートすればOK

$ sudo service apache2 restart

以上

9
9
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
9
9