コンテンツにスキップ

「Foswiki」の版間の差分

提供: ArchWiki
削除された内容 追加された内容
翻訳
 
アーカイブ
タグ: 新規リダイレクト
 
(他の1人の利用者による、間の1版が非表示)
1行目: 1行目:
#redirect [[ArchWiki:アーカイブ]]
[[Category:ウェブサーバー]]
[[Category:アーカイブ]]
[[en:Foswiki]]
[http://foswiki.org Foswiki] は Perl で書かれたフリーのエンタープライズコラボレーションプラットフォームです。ユーザーとオープンソースコミュニティによって開発・サポート・メンテナンスされています。

詳しくは [[wikipedia:Foswiki]] や [http://foswiki.org Foswiki のウェブサイト] を参照してください。

同じようなニーズに応える Java ベースのソフトウェアとして [[XWiki]] も存在します。

== インストール ==

{{Note|以下の理由から AUR には {{ic|foswiki}} パッケージが存在しません:
* 現在のところ Foswiki にはアップグレードするたびに作業が必要になります。
* Foswiki にはプラグインをインストール・アップデート・削除する便利なシステムが存在しますが、インストールディレクトリに書き込みが行えないと機能しません。}}

以下の手順では Foswiki のインストール場所として {{ic|/srv/http/foswiki}} ディレクトリを使用します。

[http://foswiki.org/System/InstallationGuide Foswiki Installation Guide] には詳しい説明があり (すこし多すぎるくらいです)、資料として役に立ちます。公式ガイドに概ね従いつつ、Arch Linux 固有の設定事項に注意してください。

* Foswiki を動作させるには以下のパッケージのインストールが必要です:
** {{Pkg|rcs}}
** {{Pkg|perl-crypt-passwdmd5}}
** {{Pkg|perl-cgi-session}}
** {{Pkg|perl-html-tree}}
** {{Pkg|perl-json}}
** {{Pkg|perl-libwww}}

* [http://foswiki.org Foswiki ウェブサイト] から最新のリリースを入手してください。
* アーカイブをダウンロードしたら {{ic|http}} ユーザーとして {{ic|/srv/http/foswiki}} に展開します。例 ({{ic|root}} で実行):
{{bc|
# su -s /bin/bash - http
$ mkdir /tmp/foswiki
$ cd /tmp/foswiki
$ wget <archive-url>
$ tar xzf Fos*
$ rm *.tgz
$ exit
# mv /tmp/foswiki/* /srv/http/foswiki
# rmdir /tmp/foswiki
# cd /srv/http/foswiki
}}
* 必要に応じて、インストールディレクトリのアクセス権限を制限してください:
{{bc|
# chmod o-rx .
}}
* この段階で、全てのファイルのパーミッションが正しいことを確認してください (詳しくは Foswiki ガイドの [http://foswiki.org/Support.SettingFileAccessRightsLinuxUnix Setting File Access Permissions] を参照)。

:ファイルのパーミッションが適切かどうか確認したい場合、{{ic|find}} を使うことでパーミッションをテストできます。例えば、以下のコマンドはアクセスモードが 755 に設定されていないディレクトリが存在するか確認します:
{{bc|
# find . -type d \! -perm 755
}}

:バージョン '''1.1.5''' 現在、所有者しか書き込めないように誤って設定されているファイルがひとつだけ存在します。他のファイルはアーカイブから展開したときのままでパーミッションは問題ありません。以下のコマンドを使うことで正しいパーミッションを設定し ({{ic|root}} または {{ic|http}} で実行)、同じ問題が起こる可能性のあるファイルを取得します:
{{bc|
$ find pub data -name '*,v' -type f -exec chmod 444 \{\} \;
}}

* {{ic|bin/LocalLib.cfg.txt}} を {{ic|bin/LocalLib.cfg}} にコピーしてください。所有者とアクセス権限が元のファイルと同じであることを確認してください。
* 新しくコピーしたファイルを編集して {{ic|$foswikiLibPath}} 行を以下のようにしてください:
{{bc|1=
$foswikiLibPath = '/srv/http/foswiki/lib';
}}

== Apache ==

Foswiki インストールガイドの [http://foswiki.org/System/InstallationGuide#Configure_the_web_server Configure the Webserver] セクションを見て Apache を設定してください。

== Nginx ==

Nginx で Foswiki を使うのは厄介ですが、以下で全て説明します。必要に応じて変更ができるように、設定にはコメントを付します。

Foswiki は Perl で書かれており一連の CGI スクリプトとして実行されるようになっています。FastCGI アプリケーションとして Foswiki を実行したい場合は [http://foswiki.org/System/FastCGIEngineContrib FastCGIEngineContrib] を確認してください。ただし FastCGI を使用した場合、一部のプラグインが動作しません。

* {{Pkg|fcgiwrap}} をインストールしてください ([[Nginx#手順1: fcgiwrap]] を参照)。ここではソケットを使って {{ic|fcgiwrap}} をセットアップした環境を使います。

* {{ic|/etc/nginx/foswiki.conf}} という名前のファイルを以下の内容で作成します:

{{bc|1=
location /bin/configure {
# It is important to protect this location with a password.
auth_basic "Restricted";
auth_basic_user_file htpasswd/foswiki-configure;
# (Temporarily?) allow an IP address below for configuration access
#allow 127.0.0.1;
deny all;
fastcgi_pass fcgiwrap;
include fastcgi.conf;
fastcgi_split_path_info ^(/bin/configure)(.*);
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location /bin/ {
fastcgi_pass fcgiwrap;
include fastcgi.conf;
fastcgi_split_path_info ^(/bin/\w+)(.*);
fastcgi_param PATH_INFO $fastcgi_path_info;
# Setting the NO_FOSWIKI_SESSION environment variable prevents a
# session being created. If a bot is spawning too many sessions, add its
# user agent string to this regexp.
set $no_foswiki_session "";
if ($http_user_agent ~* "^gsa-crawler") {
set $no_foswiki_session true;
}
fastcgi_param NO_FOSWIKI_SESSION $no_foswiki_session;
# This prevents the %INCLUDE% macro from including our own topics as URLs
# and also prevents other Foswikis from doing the same. This is important to
# prevent the most obvious Denial of Service attacks.
if ($http_user_agent = "") { return 403; }
}
# Contains public-facing files.
# The rewrite rule is necessary for enforcing access policies. Otherwise,
# access would be free to this directory. Comment it out if you do not like
# the performance hit (but see /pub/... locations below).
location /pub/ {
rewrite ^/pub/(.*)$ /bin/viewfile/$1 last;
}
# Prevent HTML attachments from rendering directly in the browser; it could
# potentially be a security risk.
location ~* /pub/.*\.html?$ {
types {}
default_type application/octet-stream;
}
# These locations contain CSS, JS, and other assets that are trusted and really
# need to be cached, and that we do not want going through CGI for reasons of
# performance. The ^~ prefix prevents the above HTML security fix from applying
# to these locations (e.g. WYSIWYG uses some HTML from /pub/System).
location ^~ /pub/System/ { # General system support files
}
location ^~ /pub/Main/SitePreferences/ { # Attachments for site logos etc...
}
# Anything in the Trash should not be visible.
# This is not necessary if access policies are being enforced for the /pub
# directory through the rewrite rule above.
#location /pub/Trash {
# deny all;
#}
location /robots.txt {
}
# Pretty URLs: /Main/Foo, /edit/Main/Foo, etc...
location / {
rewrite ^/(?:[A-Z].*)?$ /bin/view$uri last;
rewrite ^/([a-z]+/[A-Z].*) /bin/$1 last;
# The above should catch most day-to-day things. This is for some more unusual
# situations (e.g. when Main requires authentication, when resubmitting a
# form, maybe some other situations):
rewrite ^ /bin$uri last;
}
}}

{{Warning|本番環境で作業する場合、ファイル上部の {{ic|allow}} ディレクティブに注意してください。{{ic|configure}} スクリプトへのアクセスが不要な場合、コメントアウトしたままにしてください。Foswiki のセキュリティホールとなる可能性があるため、必要なければ使えないようにしたほうが安全です。}}

* ファイル上部の {{ic|allow}} ディレクティブをアンコメントして、{{ic|127.0.0.1}} をあなたのローカルマシンの IP アドレスに置き換えてください。
* {{ic|/etc/nginx/nginx.conf}} にある nginx のメイン設定ファイルに新しく server セクションを追加してください。例:

{{bc|
server {
listen 80;
server_name foswiki;
root /srv/http/foswiki;

include foswiki.conf;
}
}}

* {{ic|foswiki.conf}} ファイルから参照できるように、{{ic|nginx.conf}} の {{ic|server}} ブロックの前に {{ic|upstream}} ブロックを追加してください:

{{bc|
upstream fcgiwrap {
server unix:/var/run/fcgiwrap.sock;
}
}}

* [http://wiki.nginx.org/Faq#How_do_I_generate_an_.htpasswd_file_without_having_Apache_tools_installed.3F Nginx Wiki の手順] に従って、必要な場所に {{ic|htpasswd}} ファイルを作成してください。上記の設定ではファイルの場所は {{ic|/etc/nginx/htpasswd/foswiki-configure}} としています。ファイルのパーミッションは適切に設定してください。例えば {{ic|root}} で以下のコマンドを実行:

{{bc|
# mkdir -p /etc/nginx/htpasswd
# cd /etc/nginx/htpasswd
# printf "admin:$(openssl passwd -crypt <YOURPASSWORD>)\n" >> foswiki-configure
# chgrp http foswiki-configure
# chmod 640 foswiki-configure
}}

* ブラウザで {{ic|/configure}} の URL を開いてください。例: http://foswiki/configure.
* '''General Path Settings''' セクションで、{{ic|{ScriptUrlPaths}{view}}} 設定の中身を削除してください。完全に空白にする必要があります (これで Nginx で設定した URL が使われるようになります)。
* 他の設定は問題ありません。"Save Changes" を押して設定を保護するパスワードを設定してください (HTTP ベーシック認証と同じパスワードを設定すると良いでしょう)。
* Foswiki の設定を確認して、もういちど保存してください。
* {{ic|/etc/nginx/foswiki.conf}} の上部にある {{ic|allow}} ディレクティブをコメントアウトして {{ic|configure}} スクリプトを使えないようにしてください。
* これで Foswiki のインストールは完了です。

== インストール後の設定 ==

wiki がセットアップできたら、以下の [[cron]] ルールを設定すると良いでしょう:

* [http://foswiki.org/System/MailerContrib E-mail notifications]
* [http://foswiki.org/System/SiteToolStatistics Web statistics]

== アップグレード ==

公式の [http://foswiki.org/System.UpgradeGuide Foswiki Upgrade Guide] にアップグレードする手順が載っています。古い環境で使っていたプラグインのインストールを忘れないでください。{{ic|lib/Foswiki/Plugins}} ディレクトリを比較すると簡単です。アップグレードで一番面倒なのは古い環境から新しい環境へのトピックのコピーです。自動で行うスクリプトが存在し、古い環境で変更を加えたコアトピックのマージだけに作業を減らせます。

スクリプトは https://github.com/giddie/bits-n-pieces/blob/master/Foswiki/foswiki-copy に存在します。

* {{ic|diff}} (またはその亜種) を使って手動でマージが必要なトピックや {{ic|lib/LocalSite.cfg}} を比較してください。
* Foswiki で元の中身の版を保存したい場合、ウェブインターフェイスを使ってトピックを編集すると良いでしょう。
* 以下のファイルをコピーしてください:
** リビジョンデータが含まれている {{ic|<topic>.txt,v}} ファイル。
** 手動でマージするトピックの {{ic|pub}} フォルダ。
** ユーザーのパスワードハッシュが含まれている {{ic|data/.htpasswd}} ファイル。

2024年9月8日 (日) 17:14時点における最新版