roundcube

Roundcube #

Roundcube 是一个 PHP 网页邮箱客户端,本文介绍在 archlinux 配置好 Maddy IMAP SMTP 客户端后,如何与 Roundcube 结合,通过网页收发管理邮件。

安装 #

sudo pacman -S roundcubemail

这里使用 sqlite

sudo pacman -S sqlite

使用 php-fpm7

sudo pacman -S php7-fpm

配置 #

roundcube #

# cd /etc/webapps/roundcubemail/config
# cp config.inc.php.sample config.inc.php

编辑文件/etc/webapps/roundcubemail/config/config.inc.php,替换 DOMAIN 为实际使用 maddy 搭建所使用的

$config['db_dsnw'] = 'sqlite:////usr/share/webapps/roundcubemail/SQL/sqlite/db.sql?mode=0646'; //该成你喜欢的位置
$config['default_host'] = 'ssl://DOMAIN';
$config['default_port'] = 993;
$config['smtp_server'] = 'ssl://DOMAIN';
$config['smtp_port'] = 465;
$config['des_key'] = '必须更该';
$config['enable_installer'] = true;

nginx #

如果配置和之前一样,新建/etc/nginx/conf.d/mail.conf 添加,注意替换 DOMAIN,此处为网页邮箱的域名,/run/php-fpm7/php-fpm.sock 是 php7-fpm 的地址,不是请替换。

server {
            listen 80;
            server_name DOMAIN;
            return 301 https://$server_name$request_uri;
}
server {
    listen 443 ssl http2;
    server_name DOMAIN;
    root /usr/share/webapps/roundcubemail;
    ssl_certificate /etc/letsencrypt/live/DOMAIN/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/DOMAIN/privkey.pem;
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;
    access_log /var/log/nginx/mail_access.log;
    error_log /var/log/nginx/mail_error.log;
         location / {
            index  index.php index.html index.htm;
	    try_files $uri $uri/ /index.php;
     }
        location ~ ^/(bin|SQL|config|installer)/ {
                deny all;
        }
        location ~ ^/(.+\.md)$ {
                deny all;
        }

        location ~ \.php$ {
		    # 404
        try_files $fastcgi_script_name =404;

        # default fastcgi_params
        include fastcgi_params;

        # fastcgi settings
        fastcgi_pass            unix:/run/php-fpm7/php-fpm.sock;
        fastcgi_index           index.php;
        fastcgi_buffers         8 16k;
        fastcgi_buffer_size     32k;

        # fastcgi params
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        fastcgi_param SCRIPT_FILENAME   $realpath_root$fastcgi_script_name;
        #fastcgi_param PHP_ADMIN_VALUE  "open_basedir=$base/:/usr/lib/php/:/tmp/";
        }
}

php #

如果是 php 而不是 php7 这应编辑 /etc/php/php.ini

vim /etc/php7/php.ini

去除

;extension=pdo_sqlite
;extension=sqlite3
;extension=iconv

前的;

网页配置 #

网页邮箱的域名/installer 进入配置

其余优化 #

plugin #

$config['plugins'] = ['archive', 'zipdownload'];
$rcmail_config['skin_logo'] = '../logo.png';

timezone #

vim /etc/php7/php.ini
date.timezone = "UTC"

PDF 预览 #

配置文件添加

$config['plugins'] = array(
    'pdfviewer',
    'odfviewer'
);

配置好后 #

去除配置文件的

$config['enable_installer'] = true;