在Arch上使用Nginx/Apache安装RainLoop Webmail

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

在Arch上使用Nginx/Apache安装RainLoop Webmail

Rainloop是一个使用PHP编写的,开源免费的网页邮件客户端。他支持包括Google、Yahoo、OutLook在内的主流的邮件服务器,当然,他也支持你自己的本地邮件服务器。它看起来大致就像使用IMAP和SMTP协议的MUA(邮件客户端)一样。

RainLoop 示例

可以看一下RainLoop作者安装的演示页面: http://demo.rainloop.net/

在Arch Linux上安装RainLoop

在Arch Linux上安装RainLoop

一旦在您的服务器部署上Rainloop,剩余要做的唯一的事情是通过Web浏览器访问您的Rainloop,并提供你正在使用的邮件服务器信息。

本教程包含了在 Arch Linux上的Rainloop 网页客户端的安装流程,包括如何进行配置 Apache 或 Nginx, 当然本教程使用修改Hosts的方式,从而避免了DNS的访问。

If you also need references on installing Rainloop on Debian and Red Hat systems visit the previous RainLoop Webmail article at.

如果你还是需要一篇在Debian 和 Red Hat 安装 RainLoop Webmail 的教程,你可以看这篇文章:

以及在 Ubuntu 服务器中安装 RainLoop Webmail 的教程,你可以看这篇文章:

系统要求

对 Nginx

对 Apache

Step 1:在 Nginx 或者 Apache 上创建虚拟主机

1. 假设你已经如上面介绍的链接所述,配置好了您的服务器(NginxApache),你需要做的第一件事是在Hosts文件里创建一个原始解析记录,以指向的Arch Linux系统的IP。

对于Linux系统,修改 /etc/hosts 文件并且在你的localhost条目之下添加 Rainloop 的虚拟域。如下:

 
 
  1. 127.0.0.1 localhost.localdomain localhost rainloop.lan
  2. 192.168.1.33 rainloop.lan

添加域信息

添加域信息

如果是Windows系统,则修改 C:\Windows\System32\drivers\etc\hosts 并且将接下来的内容添加到你的文件里:

 
 
  1. 192.168.1.33 rainloop.lan

2. 使用 ping 命令确认本地的 Rainloop 域名创建成功之后,然后在 Apache 或 Nginx 中创建所需的 虚拟主机和 SSL 配置。

Nginx 虚拟主机

/etc/nginx/sites-available/ 目录下使用如下命令创建一个名叫rainloop.lan的文件:

 
 
  1. $ sudo nano /etc/nginx/sites-available/rainloop.conf

添加如下的文件内容:

 
 
  1. server {
  2. listen 80;
  3. server_name rainloop.lan;
  4.  
  5. rewrite ^ https://$server_name$request_uri? permanent;
  6. access_log /var/log/nginx/rainloop.lan.access.log;
  7. error_log /var/log/nginx/rainloop.lan.error.log;
  8. root /srv/www/rainloop/;
  9.  
  10. # serve static files
  11. location ~ ^/(images|javascript|js|css|flash|media|static)/ {
  12. root /srv/www/rainloop/;
  13. expires 30d;
  14. }
  15.  
  16. location / {
  17. index index.html index.htm index.php;
  18. autoindex on;
  19. autoindex_exact_size off;
  20. autoindex_localtime on;
  21. }
  22.  
  23. location ^~ /data {
  24. deny all;
  25. }
  26.  
  27. location ~ \.php$ {
  28. #fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)
  29. fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
  30. fastcgi_index index.php;
  31. include fastcgi.conf;
  32. }
  33. }

接下来创建SSL配置文件:

 
 
  1. $ sudo nano /etc/nginx/sites-available/rainloop-ssl.conf

添加如下内容:

 
 
  1. server {
  2. listen 443 ssl;
  3. server_name rainloop.lan;
  4.  
  5. ssl_certificate /etc/nginx/ssl/rainloop.lan.crt;
  6. ssl_certificate_key /etc/nginx/ssl/rainloop.lan.key;
  7. ssl_session_cache shared:SSL:1m;
  8. ssl_session_timeout 5m;
  9. ssl_ciphers HIGH:!aNULL:!MD5;
  10. ssl_prefer_server_ciphers on;
  11.  
  12. access_log /var/log/nginx/rainloop.lan.access.log;
  13. error_log /var/log/nginx/rainloop.lan.error.log;
  14.  
  15. root /srv/www/rainloop/;
  16.  
  17. # serve static files
  18. location ~ ^/(images|javascript|js|css|flash|media|static)/ {
  19. root /srv/www/rainloop/;
  20. expires 30d;
  21. }
  22.  
  23. location ^~ /data {
  24. deny all;
  25. }
  26.  
  27. location / {
  28. index index.html index.htm index.php;
  29. autoindex on;
  30. autoindex_exact_size off;
  31. autoindex_localtime on;
  32. }
  33.  
  34. location ~ \.php$ {
  35. #fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)
  36. fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
  37. fastcgi_index index.php;
  38. include fastcgi.conf;
  39. }
  40. }

接下来将会自动生成CertificateKeys文件,然后在文件中叫Common Name*的证书里中添加您的虚拟域名( rainloop.lan**)。

 
 
  1. $ sudo nginx_gen_ssl.sh

生成证书和密钥

生成证书和密钥

生成证书和SSL密钥后,创建Rainloop Web服务器的文件路径(Rainloop PHP文件所在的位置),然后启用虚拟主机,并重新启动Nginx的守护进程,应用配置。

 
 
  1. $ sudo mkdir -p /srv/www/rainloop
  2. $ sudo n2ensite rainloop
  3. $ sudo n2ensite rainloop-ssl
  4. $ sudo systemctl restart nginx

创建RainLoop 网页向导

创建RainLoop 网页向导

Apache 虚拟主机

/etc/httpd/conf/sites-available/中创建 rainloop.conf文件:

 
 
  1. $ sudo nano /etc/httpd/conf/sites-available/rainloop.conf

添加如下内容:

 
 
  1. <VirtualHost *:80>
  2. ServerName rainloop.lan
  3. DocumentRoot "/srv/www/rainloop/"
  4. ServerAdmin you@example.com
  5. ErrorLog "/var/log/httpd/rainloop-error_log"
  6. TransferLog "/var/log/httpd/rainloop-access_log"
  7. <Directory />
  8. Options +Indexes +FollowSymLinks +ExecCGI
  9. AllowOverride All
  10. Order deny,allow
  11. Allow from all
  12. Require all granted
  13. </Directory>
  14. </VirtualHost>

创建Apache虚拟主机

创建Apache虚拟主机

为Apache添加SSL支持:

 
 
  1. $ sudo nano /etc/httpd/conf/sites-available/rainloop-ssl.conf

添加如下文件内容:

 
 
  1. <VirtualHost *:443>
  2. ServerName rainloop.lan
  3. DocumentRoot "/srv/www/rainloop/"
  4. ServerAdmin you@example.com
  5. ErrorLog "/var/log/httpd/rainloop-ssl-error_log"
  6. TransferLog "/var/log/httpd/rainloop-ssl-access_log"
  7.  
  8. SSLEngine on
  9. SSLCertificateFile "/etc/httpd/conf/ssl/rainloop.lan.crt"
  10. SSLCertificateKeyFile "/etc/httpd/conf/ssl/rainloop.lan.key"
  11.  
  12. <FilesMatch "\.(cgi|shtml|phtml|php)$">
  13. SSLOptions +StdEnvVars
  14. </FilesMatch>
  15.  
  16. BrowserMatch "MSIE [2-5]" \
  17. nokeepalive ssl-unclean-shutdown \
  18. downgrade-1.0 force-response-1.0
  19.  
  20. CustomLog "/var/log/httpd/ssl_request_log" \
  21. "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
  22.  
  23. <Directory />
  24. Options +Indexes +FollowSymLinks +ExecCGI
  25. AllowOverride All
  26. Order deny,allow
  27. Allow from all
  28. Require all granted
  29. </Directory>
  30. </VirtualHost>

接下来将会自动生成CertificateKeys文件,然后在文件中叫Common Name*的证书里中添加您的虚拟域名( rainloop.lan**)。

 
 
  1. $ sudo apache_gen_ssl

创建SSL证书和密钥

创建SSL证书和密钥

输入组织信息

输入组织信息

After the Certificate and SSL keys are created, add Rainloop DocumentRoot path, then enable Virtual Hosts and restart Apache daemon to apply configurations. 在证书和密钥建立之后,创建 RainLoop 的DocumentRoot 所指向的目录,之后激活虚拟主机,并且重启Apache应用设置。

 
 
  1. $ sudo mkdir -p /srv/www/rainloop
  2. $ sudo a2ensite rainloop
  3. $ sudo a2ensite rainloop-ssl
  4. $ sudo systemctl restart httpd

激活虚拟主机

激活虚拟主机

Step 2: 添加必要的PHP支持

3. 无论您使用的是ApacheNginxWeb服务器,您需要激活php.ini文件下中的PHP扩展,并将新服务器的DocumentRoot目录放到 open_basedir 配置中。

 
 
  1. $ sudo nano /etc/php/php.ini

找到并且取消如下的PHP扩展的注释(LCTT译注,即启用这些模块):

 
 
  1. extension=iconv.so
  2. extension=imap.so
  3. extension=mcrypt.so
  4. extension=mssql.so
  5. extension=mysqli.so
  6. extension=openssl.so ( 注:启用 IMAPS SMTP SSL protocols)
  7. extension=pdo_mysql.so

open_basedir语句应该看起来类似如下:

 
 
  1. open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/:/srv/www/

4. 在修改好php.ini之后,重启你的服务器,然后检查 phpinfo() 输出,去看看SSL协议是否已经激活。

 
 
  1. ----------对于 Apache Web 服务器----------
  2. $ sudo systemctl restart httpd

 
 
  1. ----------对于 Nginx Web 服务器----------
  2. $ sudo systemctl restart nginx
  3. $ sudo systemctl restart php-fpm

查看 PHP 信息

查看 PHP 信息

Step 3: 下载和安装 RainLoop Webmail

5.现在可以从官方网站下载Rainloop应用并解压缩到文档根目录了,但是需要首先安装wget的unzip程序(LCTT译注,如果你已经有了可以忽略此步)。

 
 
  1. $ sudo pacman -S unzip wget

6. 使用wget命令或通过使用浏览器访问http://rainloop.net/downloads/下载最新的源码包Rainloop 压缩包。

 
 
  1. $ wget http://repository.rainloop.net/v1/rainloop-latest.zip

下载 RainLoop 包

下载 RainLoop 包

7. 下载过程完成后,解压Rainloop压缩包到虚拟主机文档根目录路径( /srv/www/rainloop/ )。

 
 
  1. $ sudo unzip rainloop-latest.zip -d /srv/www/rainloop/

解压

解压

8. 然后设置应用程序的默认路径下的权限。

 
 
  1. $ sudo chmod -R 755 /srv/www/rainloop/
  2. $ sudo chown -R http:http /srv/www/rainloop/

设置权限

设置权限

Step 4: 通过网页配置RainLoop

9. Rainloop应用程序可以通过两种方式进行配置:使用浏览器或者系统shell。如果要在终端配置就打开和编辑位于/ srv/www/rainloop/data/datada047852f16d2bc7352b24240a2f1599/default/configs/ 的application.ini**文件。

10. 若要从浏览器访问管理界面,使用下面的URL地址 https://rainloop.lan/?admin,然后提供输入默认的应用程序用户名密码,如下:

 
 
  1. User = admin
  2. Password = 12345

Rainloop Web 界面

Rainloop Web 界面

11. 首次登录后,你会被警示需要更改默认密码,所以我劝你做这一点。

修改默认 Password

修改默认 Password

设置新的 Admin Password

设置新的 Admin Password

12. 如果您要启用Contact(联系人)功能,就登录到MySQL数据库并创建一个新的数据库及其用户,然后提供在Contacts字段里面输入数据库信息。

 
 
  1. mysql -u root -p
  2. create database if not exists rainloop;
  3. create user rainloop_user@localhost identified by password”;
  4. grant all privileges on rainloop.* to rainloop_user@localhost;
  5. flush privileges;
  6. exit;

在 RainLoop 中激活联系人

在 RainLoop 中激活联系人

添加联系人数据库配置

添加联系人数据库配置

13. 默认情况下Rainloop提供了** GmailYahooOutlook**的邮件服务器的配置文件,但是你如果愿意,你也可以添加其他的邮件服务器域。

默认 Mail 域

默认 Mail 域

添加新域

添加新域

14. 登录你的邮件服务器,访问 https://rainloop.lan,并提供您的域名服务器验证信息。

 

登录到Yahoo邮件页面

登录到Yahoo邮件页面

登录Gmail

登录Gmail

RainLoop 登录后的Email 界面

RainLoop 登录后的Email 界面

通过Rainloop你可以从浏览器中访问具有Internet连接的任何邮件服务器。唯一的缺憾就是在Arch Linux下使用Rainloop应用的话,少一个修改电子邮件帐户密码的poppassd插件包。

原文发布时间:2014-06-20

本文来自云栖合作伙伴“linux中国”

相关实践学习
基于函数计算快速搭建Hexo博客系统
本场景介绍如何使用阿里云函数计算服务命令行工具快速搭建一个Hexo博客。
目录
相关文章
|
15天前
|
网络安全 Apache
Apache服务器安装SSL证书
Apache服务器安装SSL证书
19 0
|
1月前
|
应用服务中间件 nginx
Nginx安装nginx-rtmp-module模块
【2月更文挑战第4天】 nginx中的模块虽然就是类似插件的概念,但是它无法像VsCode那样轻松的安装扩展。 nginx要安装其它模块必须同时拿到nginx源代码和模块源代码,然后手动编译,将模块打到nginx中,最终生成一个名为nginx的可执行文件。
74 6
|
2月前
|
负载均衡 Ubuntu 应用服务中间件
|
2月前
|
缓存 负载均衡 应用服务中间件
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
71 1
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
|
6天前
|
应用服务中间件 nginx
yum 安装报错 No package nginx available Error:Nothing to do
yum 安装报错 No package nginx available Error:Nothing to do
17 1
|
26天前
|
应用服务中间件 Linux PHP
Linux下安装php环境并且配置Nginx支持php-fpm模块
Linux下安装php环境并且配置Nginx支持php-fpm模块
28 0
|
27天前
|
前端开发 应用服务中间件 网络安全
http转为https,ssl证书安装及nginx配置
http转为https,ssl证书安装及nginx配置
43 1
|
28天前
|
网络协议 应用服务中间件 网络安全
linxu安装nginx
linxu安装nginx
64 0
|
1月前
|
NoSQL 关系型数据库 MySQL
Docker安装详细步骤及相关环境安装配置(mysql、jdk、redis、自己的私有仓库Gitlab 、C和C++环境以及Nginx服务代理)
Docker安装详细步骤及相关环境安装配置(mysql、jdk、redis、自己的私有仓库Gitlab 、C和C++环境以及Nginx服务代理)
209 0
|
1月前
|
负载均衡 应用服务中间件 nginx