「Roundcube」の版間の差分
(→Nginx: 同期) |
(→Roundcube のインストール: 同期) |
||
| (同じ利用者による、間の5版が非表示) | |||
| 5行目: | 5行目: | ||
== インストール == |
== インストール == |
||
| − | {{pkg|roundcubemail}} パッケージを[[インストール]]してください。さらにデータベース ([[MariaDB]] など) と [[PHP]] が動作する[[:カテゴリ:ウェブサーバー|ウェブサーバー]] |
+ | {{pkg|roundcubemail}} パッケージを[[インストール]]してください。さらにデータベース ([[MariaDB]] など) と [[PHP]] が動作する[[:カテゴリ:ウェブサーバー|ウェブサーバー]]が必要です。 |
== 設定 == |
== 設定 == |
||
| − | === |
+ | === MariaDB === |
| − | |||
| − | ==== MariaDB ==== |
||
以下は [[MariaDB]] を使って Roundcube のデータベースをセットアップする例です。データベースの名前は {{ic|roundcubemail}} で、ユーザーは {{ic|roundcube}} でパスワードは {{ic|password}} とします: |
以下は [[MariaDB]] を使って Roundcube のデータベースをセットアップする例です。データベースの名前は {{ic|roundcubemail}} で、ユーザーは {{ic|roundcube}} でパスワードは {{ic|password}} とします: |
||
| 24行目: | 22行目: | ||
$ mysql -u root -p roundcubemail < /usr/share/webapps/roundcubemail/SQL/mysql.initial.sql |
$ mysql -u root -p roundcubemail < /usr/share/webapps/roundcubemail/SQL/mysql.initial.sql |
||
| − | + | === SQLite === |
|
| − | SQLite |
+ | [[SQLite]] DB は Roundcube によって自動的に作成されます。設定に指定されたファイルが {{ic|basedir}} に配置されていることを確認してください。basedir定義に {{ic|/var/lib/roundcubemail}} を追加することを検討してください。これは、ディレクトリを作成し、{{ic|http}} に [[chown]] することを意味します。 |
| − | + | === 他のデータベース === |
|
Roundcubemail には MS SQL, Oracle, [[PostgreSQL]] のインストールスクリプトが存在します。 |
Roundcubemail には MS SQL, Oracle, [[PostgreSQL]] のインストールスクリプトが存在します。 |
||
| 36行目: | 34行目: | ||
サンプル設定ファイルをコピーして必要に応じて修正してください: |
サンプル設定ファイルをコピーして必要に応じて修正してください: |
||
| − | # |
+ | # cd /etc/webapps/roundcubemail/config |
| + | # cp config.inc.php.sample config.inc.php |
||
| + | # chown http:http config.inc.php |
||
メールサーバーの設定を行って、{{ic|enable_installer}} を設定してセットアップウィザードを有効化してください: |
メールサーバーの設定を行って、{{ic|enable_installer}} を設定してセットアップウィザードを有効化してください: |
||
| 48行目: | 48行目: | ||
$config['enable_installer'] = true; |
$config['enable_installer'] = true; |
||
</nowiki>}} |
</nowiki>}} |
||
| + | |||
| + | Roundcube がファイル名拡張子から MIME タイプを検出できるようにするには、roundcube が mime.types ファイルを指すようにする必要があります。通常、Apache にはこれが付属しています。 |
||
| + | |||
| + | # cp /etc/httpd/conf/mime.types /etc/webapps/roundcubemail/config/mime.types |
||
| + | # chown http:http /etc/webapps/roundcubemail/config/mime.types |
||
| + | |||
| + | {{hc|/etc/webapps/roundcubemail/config/config.inc.php|<nowiki> |
||
| + | $config['mime_types'] = RCUBE_INSTALL_PATH . 'config/mime.types'; |
||
| + | </nowiki>}} |
||
| + | |||
| + | Apache を使用していない場合は、{{ic|/etc/webapps/roundcubemail/config/defaults.inc.php}} で入手可能な情報を確認してください。 |
||
=== PHP === |
=== PHP === |
||
| 62行目: | 73行目: | ||
{{ic|php.ini}} で {{ic|open_basedir}} を設定している場合、PHP から Roundcube のファイルが開けるように {{ic|/etc/webapps}} と {{ic|/usr/share/webapps}} が含まれていることを確認してください。{{ic|open_basedir}} を無効化・コメントアウトしている場合 (デフォルト設定)、何もする必要はありません。 |
{{ic|php.ini}} で {{ic|open_basedir}} を設定している場合、PHP から Roundcube のファイルが開けるように {{ic|/etc/webapps}} と {{ic|/usr/share/webapps}} が含まれていることを確認してください。{{ic|open_basedir}} を無効化・コメントアウトしている場合 (デフォルト設定)、何もする必要はありません。 |
||
| − | === ウェブサーバー === |
+ | === ウェブサーバー (Apache) === |
| − | |||
| − | ==== Apache ==== |
||
Apache の設定を設定ディレクトリにコピーしてください: |
Apache の設定を設定ディレクトリにコピーしてください: |
||
| 78行目: | 87行目: | ||
その後 Apache ({{ic|httpd.service}}) を再起動してください。 |
その後 Apache ({{ic|httpd.service}}) を再起動してください。 |
||
| + | {{Note|[[Apache HTTP Server#php-fpm と mod_proxy_fcgi を使う|php-fpm]] を使用している場合は、{{ic|php_admin_value open_basedir}} 行を削除します。削除しないと、ページにアクセスできなくなります。}} |
||
| − | ==== ウェブサーバー (Nginx) ==== |
||
| + | |||
| + | === ウェブサーバー (Nginx) === |
||
{{Warning|これは、Web ルートのサブディレクトリで実行されている RoundCube の設定例であり、複数のソースからの情報を用いた実験に基づいてコンパイルされています。注意して進めてください。}} |
{{Warning|これは、Web ルートのサブディレクトリで実行されている RoundCube の設定例であり、複数のソースからの情報を用いた実験に基づいてコンパイルされています。注意して進めてください。}} |
||
| 165行目: | 176行目: | ||
== Roundcube のインストール == |
== Roundcube のインストール == |
||
| − | ブラウザで |
+ | ブラウザで Roundcube インストールウィザードにアクセスできます: http://localhost/roundcube/installer または、代替 nginx 設定を使用されている場合は http://localhost/webmail/installer/ |
| − | セキュリティ上、ウィザード |
+ | {{Warning|セキュリティ上の理由から、'''ウィザードが完了したらインストーラーを無効にする必要があります''': {{ic|config.inc.php}} から {{ic|1=$config['enable_installer'] = true;}} を削除してインストーラーを無効化してください。}} |
{{ic|~/roundcube/config}} ディレクトリにはサーバーに関する重要な情報が含まれるため、以下の設定を追加してディレクトリにアクセスできないようにすることを推奨します: |
{{ic|~/roundcube/config}} ディレクトリにはサーバーに関する重要な情報が含まれるため、以下の設定を追加してディレクトリにアクセスできないようにすることを推奨します: |
||
2024年3月29日 (金) 14:01時点における最新版
Roundcube は機能豊富な PHP によるウェブベースのメールクライアントです。
インストール
roundcubemail パッケージをインストールしてください。さらにデータベース (MariaDB など) と PHP が動作するウェブサーバーが必要です。
設定
MariaDB
以下は MariaDB を使って Roundcube のデータベースをセットアップする例です。データベースの名前は roundcubemail で、ユーザーは roundcube でパスワードは password とします:
$ mysql -u root -p
CREATE DATABASE roundcubemail; GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost' IDENTIFIED BY 'password';
使用するデータベースに関係なく、最初に roundcubemail のデータベーステーブルを初期化する必要があります。MariaDB の場合:
$ mysql -u root -p roundcubemail < /usr/share/webapps/roundcubemail/SQL/mysql.initial.sql
SQLite
SQLite DB は Roundcube によって自動的に作成されます。設定に指定されたファイルが basedir に配置されていることを確認してください。basedir定義に /var/lib/roundcubemail を追加することを検討してください。これは、ディレクトリを作成し、http に chown することを意味します。
他のデータベース
Roundcubemail には MS SQL, Oracle, PostgreSQL のインストールスクリプトが存在します。
Roundcube
サンプル設定ファイルをコピーして必要に応じて修正してください:
# cd /etc/webapps/roundcubemail/config # cp config.inc.php.sample config.inc.php # chown http:http config.inc.php
メールサーバーの設定を行って、enable_installer を設定してセットアップウィザードを有効化してください:
/etc/webapps/roundcubemail/config/config.inc.php
$config['db_dsnw'] = 'mysql://roundcube:****@localhost/roundcubemail'; $config['default_host'] = 'tls://localhost'; // IMAP host $config['smtp_server'] = 'tls://localhost'; $config['smtp_port'] = 587; $config['des_key'] = 'some_awesome_long_semi_random_string'; $config['enable_installer'] = true;
Roundcube がファイル名拡張子から MIME タイプを検出できるようにするには、roundcube が mime.types ファイルを指すようにする必要があります。通常、Apache にはこれが付属しています。
# cp /etc/httpd/conf/mime.types /etc/webapps/roundcubemail/config/mime.types # chown http:http /etc/webapps/roundcubemail/config/mime.types
/etc/webapps/roundcubemail/config/config.inc.php
$config['mime_types'] = RCUBE_INSTALL_PATH . 'config/mime.types';
Apache を使用していない場合は、/etc/webapps/roundcubemail/config/defaults.inc.php で入手可能な情報を確認してください。
PHP
PHP の設定で以下の変数を設定してください:
/etc/php/php.ini
date.timezone = "UTC"
そして以下の行をアンコメントしてください:
extension=iconv.so
php.ini で open_basedir を設定している場合、PHP から Roundcube のファイルが開けるように /etc/webapps と /usr/share/webapps が含まれていることを確認してください。open_basedir を無効化・コメントアウトしている場合 (デフォルト設定)、何もする必要はありません。
ウェブサーバー (Apache)
Apache の設定を設定ディレクトリにコピーしてください:
# cp /etc/webapps/roundcubemail/apache.conf /etc/httpd/conf/extra/roundcube.conf
そして以下の行を追加してください:
/etc/httpd/conf/httpd.conf
Include conf/extra/roundcube.conf
その後 Apache (httpd.service) を再起動してください。
ウェブサーバー (Nginx)
Roundcube の location ブロックを追加してください:
/etc/nginx/nginx.conf
location /webmail {
alias /usr/share/webapps/roundcubemail;
access_log /var/log/nginx/roundcube_access.log;
error_log /var/log/nginx/roundcube_error.log;
# Favicon
location ~ ^/webmail/favicon.ico$ {
root /usr/share/webapps/roundcubemail/skins/classic/images;
log_not_found off;
access_log off;
expires max;
}
# Robots file
location ~ ^/webmail/robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny Protected directories
location ~ ^/webmail/(config|temp|logs)/ {
deny all;
}
location ~ ^/webmail/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
deny all;
}
location ~ ^/webmail/(bin|SQL)/ {
deny all;
}
# Hide .md files
location ~ ^/webmail/(.+\.md)$ {
deny all;
}
# Hide all dot files
location ~ ^/webmail/\. {
deny all;
access_log off;
log_not_found off;
}
# Roundcube fastcgi config
location ~ /webmail(/.*\.php)$ {
include fastcgi.conf;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_split_path_info ^/webmail/(.+\.php)(/.*)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PHP_VALUE open_basedir="/tmp/:/var/cache/roundcubemail:/usr/share/webapps/roundcubemail:/etc/webapps/roundcubemail:/usr/share/pear/:/var/log/roundcubemail";
}
}
Roundcube のより新しいバージョンでは、fastcgi_split_path_info と fastcgi_param PATH_INFO を手動で設定すると、Roundcube が誤動作する原因となりました。$request_filename も機能しませんでした。 解決策としては以下のような設定が必要です。
location ~ /webmail/?$ {
include fastcgi.conf;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/webapps/roundcubemail/index.php;
fastcgi_param PHP_VALUE open_basedir="/tmp/:/var/cache/roundcubemail:/var/lib/roundcubemail:/usr/share/webapps/roundcubemail:/etc/webapps/roundcubemail:/usr/share/pear/:/var/log/roundcubemail:/var/lib/roundcubemail";
}
別の設定を使用するには、インストーラーにアクセスするために location block が必要になります:
location ~ /webmail/installer/?.*$ {
include fastcgi.conf;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/webapps/roundcubemail/installer/index.php;
fastcgi_param PHP_VALUE open_basedir="/tmp/:/var/cache/roundcubemail:/var/lib/roundcubemail:/usr/share/webapps/roundcubemail:/etc/webapps/roundcubemail:/usr/share/pear/:/var/log/roundcubemail:/var/lib/roundcubemail";
}
その後 nginx.service を 再起動 してください。
Roundcube のインストール
ブラウザで Roundcube インストールウィザードにアクセスできます: http://localhost/roundcube/installer または、代替 nginx 設定を使用されている場合は http://localhost/webmail/installer/
~/roundcube/config ディレクトリにはサーバーに関する重要な情報が含まれるため、以下の設定を追加してディレクトリにアクセスできないようにすることを推奨します:
/etc/httpd/conf/extra/roundcube.conf
<Directory /usr/share/webapps/roundcubemail/config>
Options -FollowSymLinks
AllowOverride None
Require all denied
</Directory>
ヒントとテクニック
TLS 認証しかできない IMAP/SMTP サーバーを使用する
最近の IMAP/SMTP サーバーでは暗号化された認証 (STARTTLS) しかできないのが普通です。TLS 認証を使用する場合、ウェブベースのインストーラーは役に立ちません。/etc/webapps/roundcubemail/config/config.inc.php を手動で編集して、以下の行を追加してください:
$config['default_host'] = 'tls://mail.my_domain.org';
// For STARTTLS IMAP
$config['imap_conn_options'] = array(
'ssl' => array(
'verify_peer' => true,
// certificate is not self-signed if cafile provided
'allow_self_signed' => false,
'cafile' => '/etc/ssl/certs/Your_CA_certificate.pem',
// probably optional parameters
'ciphers' => 'TLSv1+HIGH:!aNull:@STRENGTH',
'peer_name' => 'mail.my_domain.org',
),
);
// For STARTTLS SMTP
$config['smtp_conn_options'] = array(
'ssl' => array(
'verify_peer' => true,
// certificate is not self-signed if cafile provided
'allow_self_signed' => false,
'cafile' => '/etc/ssl/certs/Your_CA_certificate.pem',
// probably optional parameters
'ciphers' => 'TLSv1+HIGH:!aNull:@STRENGTH',
'peer_name' => 'mail.my_domain.org',
),
);
mail.my_domain.org は SSL 証明書の CN ホストネーム (IMAP サーバーのホストネーム) に、/etc/ssl/certs/Your_CA_certificate.pem は SSL 証明書のパスに置き換えてください。ciphers は IMAP サーバーによって許可されている暗号にあわせて編集してください。
PHP の SSL 設定オプションについては こちら を参照。
PDF と OpenDocument ファイルのプレビュー
Roundcube の拡張で添付された PDF や OpenDocument ファイルをプレビューすることができます。
roundcubemail-plugins-kolabAUR パッケージをインストールして設定ファイルに以下の行を追加して拡張を有効にしてください:
/etc/webapps/roundcubemail/config/config.inc.php
$config['plugins'] = array(
'pdfviewer',
'odfviewer'
);
ファイルのパーミッションに問題が起こる場合、以下のコマンドを試してみてください:
# chown -R http:http /usr/share/webapps/roundcubemail/plugins/odfviewer/files
カレンダーのサポート
roundcubemail-plugins-kolabAUR パッケージをインストールします。
Roundcube データベースを更新する
# mysql -u root -p roundcubemail < /usr/share/webapps/roundcubemail/plugins/calendar/drivers/database/SQL/mysql.initial.sql
カレンダーサービスを設定する
ほとんどのアプリケーションではデフォルト設定で十分ですが、それを所定の位置に移動する必要があります。
# cp /usr/share/webapps/roundcubemail/plugins/calendar/config.inc.php.dist /usr/share/webapps/roundcubemail/plugins/calendar/config.inc.php
Sabre\VObject\Property\Text Not Found
エラーが表示される場合、プラグインに Sabre が含まれていないか、バージョンが古くなっています。更新してください:
# cd /usr/share/webapps/roundcubemail ; composer update ; composer require sabre/dav ~3.1.3
プラグインの有効化
/etc/webapps/roundcubemail/config/config.inc.php
$config['plugins'] = array(
'calendar'
);
CardDav でアドレス帳を同期
アドレス帳を使ってアドレスなどを自動補完できると便利です。連絡先をどこかに保存していて、リモートアプリケーションによって CardDav で同期できる場合、roundcube-rcmcarddavAUR[リンク切れ: パッケージが存在しません] 拡張を使うことで Roundcube でリモートのアドレス帳にアクセスできます。有効にするには、以下の行を設定ファイルに追加してください:
/etc/webapps/roundcubemail/config/config.inc.php
$config['plugins'] = array(
'carddav'
);
詳しくは こちら を参照してください。
SpamAssassin のトレーニングに Mark as Junk プラグインを使用する
markasjunk プラグインは、メッセージメニューに "mark as spam" または "mark as not spam" ボタンを追加します。次のセットアップでは、そのような機能を使用して、sa-learn で SpamAssassin フィルターを簡単にトレーニングします
同じディレクトリに /usr/share/webapps/roundcubemail/plugins/markasjunk/config.inc.php.dist のコピーを config.inc.php として作成し、次のように変更します。次に、次のものが揃っていることを確認してください:
/usr/share/webapps/roundcubemail/plugins/markasjunk/config.inc.php
$config['markasjunk_learning_driver'] = 'cmd_learn'; $config['markasjunk_spam_cmd'] = '/usr/bin/vendor_perl/sa-learn --spam --username=%u %f'; $config['markasjunk_ham_cmd'] = '/usr/bin/vendor_perl/sa-learn --ham --username=%u %f';
プラグインを有効にします:
/etc/webapps/roundcubemail/config/config.inc.php
$config['plugins'] = [
'markasjunk'
];
トラブルシューティング
SMTP Error: Authentication failure
config.inc.php の以下の設定を無効化 (コメントアウト) してみてください:
//$config['smtp_user'] = '%u'; //$config['smtp_pass'] = '%p';
Recipient address rejected
TLS または STARTTLS を使用しているかどうかに応じて、次のいずれかのエラーが発生する可能性があります:
530 5.7.0 Must issue a STARTTLS command first 554 5.7.1 <>: Recipient address rejected: Access denied
その場合は、次の行を config.inc.php に追加してみてください。
$config['smtp_user'] = '%u'; $config['smtp_pass'] = '%p';