设为首页 收藏本站
查看: 1820|回复: 0

[经验分享] Postfix邮箱(十一):Webmail支持FCGI和SSL

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-12-25 08:04:21 | 显示全部楼层 |阅读模式
一、增加FCGI支持
说明:为了获得优异的web效能,克服CGI不能应付大量访问及低效率的缺陷
1、安装apache的mod_fastcgi模块
1
2
3
4
5
6
7
8
9
[iyunv@mail ~]# yum install -y httpd-devel
[iyunv@mail ~]# cd /usr/local/src
[iyunv@mail src]# wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
[iyunv@mail src]# tar zxvf mod_fastcgi-2.4.6.tar.gz
[iyunv@mail src]# cd mod_fastcgi-2.4.6
[iyunv@mail mod_fastcgi-2.4.6]# cp Makefile.AP2 Makefile
#搜索~httpd/build目录路径,赋值给top_dir进行安装
[iyunv@mail mod_fastcgi-2.4.6]# find / -name "build" -type d
[iyunv@mail mod_fastcgi-2.4.6]# make top_dir=/usr/lib64/httpd/ install



2、查看模块是否生成
1
2
[iyunv@mail mod_fastcgi-2.4.6]# ls /etc/httpd/modules/mod_fastcgi.so
/etc/httpd/modules/mod_fastcgi.so



3、安装Extmail需要的perl-FCGI模块
1
[iyunv@mail mod_fastcgi-2.4.6]# yum install perl-FCGI



4、配置虚拟主机文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[iyunv@mail mod_fastcgi-2.4.6]# vi /etc/httpd/conf.d/extmail.conf
LoadModule fastcgi_module modules/mod_fastcgi.so
   
    FastCgiExternalServer /usr/bin/dispatch.fcgi -host 127.0.0.1:8888 -idle-timeout 240
   

#ScriptAlias /extmail/cgi/ /var/www/extsuite/extmail/cgi/
Alias /extmail/cgi/ /usr/bin/dispatch.fcgi/
ScriptAlias /extman/cgi/ /var/www/extsuite/extman/cgi/
Alias /extman/cgi/ /usr/bin/dispatch.fcgi/
   
      SetHandler fastcgi-script
   




说明:上面的/usr/bin/dispatch.fcgi并不存在,但是必须按上面的写。

5、启动
修改启动脚本:
1
2
3
[iyunv@mail mod_fastcgi-2.4.6]# vi /var/www/extsuite/extmail/dispatch-init
SU_UID=vmail
SU_GID=vmail



启动进程:
1
2
3
4
5
6
7
8
9
10
[iyunv@mail mod_fastcgi-2.4.6]# /var/www/extsuite/extmail/dispatch-init start
[iyunv@mail mod_fastcgi-2.4.6]# echo "/var/www/extsuite/extmail/dispatch-init start" >> /etc/rc.d/rc.local
[iyunv@mail mod_fastcgi-2.4.6]# service httpd restart
[iyunv@mail mod_fastcgi-2.4.6]# ps aux|grep dispatch.fcgi
vmail    18737  0.0  0.5 139048  5588 ?        SNs  11:00   0:00 dispatch.fcgi (master)
vmail    18738  0.0  0.5 139048  5432 ?        SN   11:00   0:00 dispatch.fcgi (idle)
vmail    18739  0.0  0.5 139048  5432 ?        SN   11:00   0:00 dispatch.fcgi (idle)
root     18762  0.0  0.0 103256   864 pts/2    S+   11:02   0:00 grep dispatch.fcgi
[iyunv@mail mod_fastcgi-2.4.6]# netstat -tnlp|grep 8888
tcp        0      0 127.0.0.1:8888              0.0.0.0:*                   LISTEN      18737/dispatch.fcgi




说明:这里没有对extman启用FCGI,因为启用后会出现一个错误,详见:
http://www.extmail.org/forum/thread-12859-1-1.html



二、增加SSL登陆
1、安装ssl模块
1
[iyunv@mail ~]# yum install mod_ssl



2、创建密钥、证书
(1)查看本地密钥和证书位置
1
2
3
[iyunv@mail ~]# vi /etc/httpd/conf.d/ssl.conf
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key



(2)重建本地密钥
1
2
3
[iyunv@mail ~]# cd /etc/pki/tls/private
[iyunv@mail private]# rm -f localhost.key
[iyunv@mail private]# openssl genrsa 1024 > localhost.key



(3)重建本地证书
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[iyunv@mail private]# cd ../certs
[iyunv@mail certs]# rm -rf localhost.crt
[iyunv@mail certs]# openssl req -new -x509 -days 365 -key ../private/localhost.key -out localhost.crt
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:zhejiang
Locality Name (eg, city) [Default City]:hangzhou
Organization Name (eg, company) [Default Company Ltd]:yourmail   
Organizational Unit Name (eg, section) []:it
Common Name (eg, your name or your server s hostname) []:
Email Address []:



3、配置虚拟主机
说明:将conf.d下的extmail.conf内容移至ssl.conf中,使用SSL的443端口进行WEB连接。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[iyunv@mail certs]# cd /etc/httpd/conf.d
[iyunv@mail conf.d]# mv extmail.conf extmail.conf.bak
[iyunv@mail conf.d]# vi ssl.confLoadModule fastcgi_module modules/mod_fastcgi.so

FastCgiExternalServer /usr/bin/dispatch.fcgi -host 127.0.0.1:8888 -idle-timeout 240

#在下行之上添加以上内容

#在上行之下添加以下内容
ServerName mail.yourmail.com:443
DocumentRoot /var/www/extsuite/extmail/html/
#ScriptAlias /extmail/cgi/ /var/www/extsuite/extmail/cgi/
Alias /extmail/cgi/ /usr/bin/dispatch.fcgi/
  
  SetHandler fastcgi-script
  
Alias /extmail /var/www/extsuite/extmail/html/
ScriptAlias /extman/cgi/ /var/www/extsuite/extman/cgi/
Alias /extman /var/www/extsuite/extman/html/
SuexecUserGroup vmail vmail



注释掉根目录:
    否则错误日志中会显示File does not exist: /var/www/html/favicon.ico
    网页标签中会显示d图标(DSPAM的)
1
2
[iyunv@mail conf.d]# vi ../conf/httpd.conf
#DocumentRoot "/var/www/html"



4、重启服务
1
2
3
4
5
[iyunv@mail ~]# service httpd restart
[iyunv@mail ~]# iptables -I INPUT -p tcp --dport 443 -j ACCEPT
[iyunv@mail ~]# service iptables save
[iyunv@mail ~]# netstat -tnlp|grep 443
tcp        0      0 :::443                      :::*                        LISTEN      19691/httpd



5、访问页面
http://的页面已经无法访问了:
wKiom1SaESnTWSyMAAHbd4NRKMQ580.jpg
https://的页面会提示证书不安全,不用管,点继续浏览:
wKioL1SaEdSD4bqdAAJUS-ALUjQ900.jpg
Extmail成功支持SSL,这里标签上显示的是DSPAM的图标,因为我没有将其删除导致的。
wKiom1SaESnwPryoAALDdglWIEc919.jpg
DSPAM的页面也可以使用SSL了: wKiom1SaEleTPxQAAAVnn4rNoq0188.jpg
而DSPAM的原页面无法看到历史数据了:
wKioL1SaEwHC5ZYfAAImVBmpRLE043.jpg



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-38566-1-1.html 上篇帖子: foxmail7.2服务器断开连接 errorcode: 6怎么解决 下篇帖子: Postfix邮箱(十二):修改Web页面及多域名访问
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表