[ Top > 日記 > 2019年 ]

tDiaryのインストール

2019年9月16日

tDiary を自宅サーバーにインストールしてみました。OSはFreeBSD 11.2-RELEASE です。

ports からインストールしました。

# cd /usr/ports/japanese/tdiary
# make install clean

そうすると、

  /usr/local/www/ja-tdiary

の中に必要なファイルが生成されます。

いっぽう、自分のユーザー名が foo であれば、

  /usr/home/foo/public_html/tdiary
  /usr/home/foo/tdiary

という2つのディレクトリを作っておきます。
前者はプログラムを入れるディレクトリ。後者は日記のコンテンツを入れるディレクトリです。後者は第三者がwebで見えないところに置くのが安全なのです。

portsからインストールすると、以下の手順が示されますが、今回はこれは使いません。


===>   Registering installation for ja-tdiary-5.0.13
Installing ja-tdiary-5.0.13...

=============================================================================
There is a script to install tDiary in a user directory.
This script should be run manually.

 # /usr/local/bin/ja-tdiary-inst.rb --user=User
  or
 % /usr/local/bin/ja-tdiary-inst.rb

* Option: --suexec Use suExec for CGI execution
	   --help   Display Help information

---
There are documents in the following directories.
 See ...
 /usr/local/share/doc/ja-tdiary
=============================================================================

まずは、/usr/local/www/ja-tdiary の中身を自分のディレクトリの中に入れます。

$ cp -R /usr/local/www/ja-tdiary/* /usr/home/foo/public_html/tdiary

各ファイルのパーミンションはデフォルトで大丈夫なはずです。

ここで、設定ファイル tdiary.conf においてデータを入れるディレクトリのパスだけは設定してください。

  @data_path = '/usr/home/foo/tdiary'

次に、自分のtDiaryを管理するためのパスワードを設定します。すでになにか作ってあればそれを使っても大丈夫です。

% /usr/local/sbin/htpasswd -c /usr/home/foo/.htpasswd foo

あとはパスワードを2回入れて終了です。

次にapacheの設定ファイル httpd.conf に付け加えます。

<Directory "/usr/home/foo/public_html/tdiary">
  AllowOverride None
  Options +ExecCGI
  AddHandler cgi-script .rb
  DirectoryIndex "index.rb"
  Require all granted
  <Files "*.rhtml">
    deny from all
  </Files>
  <Files "tdiary.*">
    deny from all
  </Files>
  <Files update.rb>
    AuthName tDiary
    AuthType Basic
    AuthUserFile /usr/home/foo/.htpasswd
    Require user foo
  </Files>
</Directory>

ここで重要なのは

  DirectoryIndex "index.rb"

において、ファイル名をきちんとクォーテーションマークスで囲むことです。
tDiary の公式ドキュメントでは

  DirectoryIndex index.rb

となっていました。実はこれでも

# apachectl restart

を命じたとき syntax error にならないのです。しかし実際に http://www.xxxxx.yyy/tdiary にアクセスすると、Internal Server Error になってしまうのです。私はこれがわからず、長時間悩みました。

以上のような手順で、tDiary が動くようになりました。

しかし、実際に使ってみるとどうしても画像がアップロードできません。 このため、いまのところ tDiary は使っておりません。


[ Top > 日記 > 2019年 ]