ExtMail服务器社区's Archiver

hzqbbc 发表于 2009-12-25 10:54

发布ExtMail CGI server 0.1beta(新技术高性能)

Hi all:

今天发布Extmail cgi server 0.1beta这一新软件,该软件有望取代一直有些毛病的dispatch.fcgi (FCGI服务器),使Extmail系列web程序获得FCGI一样高的性能,又没有讨厌的sort2name 等问题。以下是简介。

[size=4][b]关于Extmail CGI server[/b][/size]

程序名为cgid-0.1beta.tar.gz ,顾名思义就是一个cgi daemon(精灵守护程序),它实际是一个简化的HTTP 服务器,只负责ExtMail的cgi等动态程序处理,对于静态文件则还是由传统web 服务器处理。具体可见下图。由于每个http请求都由一个process处理,对应的cgi脚本已通过eval()方式加载到内存里,因此不存在传统CGI脚本需要fork子进程来处理的各种开销,速度基本和FCGI一样。[u]同时由于没有使用FCGI模块的I/O接口等,因此进程中的解析器还是纯Perl环境,从目前的实践来看,使用cgid后没再出现过sort2name等郁闷问题,而部分用户报session expire的问题也不在出现。[/u]

[color=Red]补充:sort2name再次出现,已找到根源,见[url]http://www.extmail.org/forum/viewthread.php?tid=12859[/url] 的分析,彻底解决办法将在最近1周内公布,请留意![/color]

[b][size=4]配置方法[/size][/b]

以nginx为例,在http {} 配置块里设置:

[quote]
http {
    client_max_body_size 8m;

    # webmail settings
    location ~ ^/extmail/cgi/.*\.cgi
    {
        proxy_pass [url]http://127.0.0.1:8080[/url];
        proxy_set_header Host $http_host;
        proxy_set_header X-real-IP $remote_addr;
        proxy_buffering off;
    }
....................
[/quote]

解压cgid-0.1beta.tar.gz 到/var/www/extsuite/下并更名为cgid,然后执行:

/var/www/extsuite/cgid/server-init start

此时ps ax|grep cgid应能看到类似:

[quote]
2018 ?        SNs    0:00 /usr/bin/perl -w /var/www/extsuite/cgid/http-cgid
5254 ?        SN     0:00 /usr/bin/perl -w /var/www/extsuite/cgid/http-cgid
5328 ?        SN     0:00 /usr/bin/perl -w /var/www/extsuite/cgid/http-cgid
[/quote]

表明启动正常。然后重启动nginx:

service nginx reload

再访问http://your-server/extmail/cgi/env.cgi  这个地址,应该能看到:

SERVER_SOFTWARE ExtMail CGI Server/0.1beta

这样的字样,如果可以看到表明cgid运行正常,然后尝试下登陆webmail吧!

[b][size=4]存在问题[/size][/b]

由于cgid设计非常简单,HTTP头固定成了200 OK,因此对于转向请求需要发送302 等http标头暂不支持,目前的解决办法是使用最新的Extmail 1.2及 Extman 1.1,其已内建了重定向时对该问题的修正。或者修改redirect函数,改为:

[quote]
sub redirect {
    my $self = shift;
    my ($url, $mode) = @_;
    print "Status: 301 Moved Permanantly\n";
    print "Location: $url\n\n";
    [color=Red]print "<html><head><META HTTP-EQUIV=refresh content=\"0;url=$url\"></head></html>";[/color]
}
[/quote]

重点见红色那行,主要作用是让浏览器在http标头不正确的情况下依然能正确重定向。经过这个简单修改后,就可以正常使用ExtMail的系列web 程序。至于sort2name等问题,还有待观察,目前几个测试用户的反映都是没见过出现了。Enjoy!

[color=Red]补充:sort2name再次出现,已找到根源,见[url]http://www.extmail.org/forum/viewthread.php?tid=12859[/url] 的分析,彻底解决办法将在最近1周内公布,请留意![/color]

yhzhou 发表于 2009-12-25 11:02

:lol坐个沙发先

herecn 发表于 2009-12-25 12:04

嗯,刚好我的FCGI有问题,换这个试一试,谢谢。:lol

ruochen0926 发表于 2009-12-25 13:29

apache的怎么修改?

extmail 发表于 2009-12-25 14:52

apahce的没测试过,不妨实验下:

[quote]
<Location /extmail/cgi/>
ProxyPass http://localhost:8080/
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
</Location>
[/quote]

shenbo7 发表于 2009-12-25 16:50

友情帮顶。。。。:lol :lol

tonny0830 发表于 2009-12-25 16:50

强哥,你是传说中的外星人么?我顶你!!!

风云城主 发表于 2009-12-25 16:53

顶顶先,改天拿到服务器上测试测试:lol

herecn 发表于 2009-12-25 16:55

问下这里
location /extmail/cgi/
    {
       fastcgi_pass          127.0.0.1:8888;
       fastcgi_index         index.cgi;
       fastcgi_param  SCRIPT_FILENAME   /data/www/extsuite/extmail/$fastcgi_script_name;
       include fcgi.conf;
    }

    fastcgi_pass          127.0.0.1:8888是不是要修改成    fastcgi_pass          127.0.0.1:8080?

vema 发表于 2009-12-25 17:05

友情帮顶

cary96 发表于 2009-12-25 17:14

好东西,顶一下!:lol

henku126 发表于 2009-12-25 17:20

顶个先,下来试试 呵呵

桂林仔 发表于 2009-12-25 17:26

这么好的东西,爽

extmail 发表于 2009-12-25 17:40

9楼,别搞错,不是fastcgi,一定要仔细参考1楼的配置。nginx使用反向代理,不是fcgi方式!

herecn 发表于 2009-12-25 20:44

location ~ ^/extmail/cgi/.*\.cgi
    {
        proxy_pass [url]http://127.0.0.1:8080[/url];
        proxy_set_header Host $http_host;
        proxy_set_header X-real-IP $remote_addr;
        proxy_buffering off;

这段代码应该放到server{}里面吧
既然做的反向代理是不是还要include proxy.conf?

ryuhi 发表于 2009-12-25 22:58

nginx不会玩,等待发布apache版的指导意见,呵呵

hzqbbc 发表于 2009-12-26 08:21

补充一下,CGI server虽然不是解决sort2name的根本办法,但它有个好处,即配合nginx, lighttpd 等方便实现webmail的负载均衡,分布式存储:lol :lol

lixvfei 发表于 2009-12-27 13:23

顶下哈哈。。

smallthing 发表于 2009-12-30 05:34

不知道是到底是fcgi快还是这样的perl服务器快……有空有谁测试一下 这个我的感觉应该是能相近吧 但是可能还是有一点点差距

smallthing 发表于 2010-1-1 12:14

哎呀 怎么看不到附件……

z0800 发表于 2010-1-4 11:14

要顶一下的。

pen10 发表于 2010-1-5 09:57

支持啊,

fengyong 发表于 2010-1-5 13:44

:lol 智强---越来越强
:victory: :victory:

lvxintong 发表于 2010-1-28 23:26

好东西,强顶

好东西,强顶:handshake

zdslua 发表于 2010-3-27 10:31

太帅了,支持一下,

zdslua 发表于 2010-4-25 15:56

OpenBSD下简单安装
cgid-0.1beta.tar.gz 释放到 /var/www/extsuite/cgid
在用户组没有改的时候运行 ./server-init start 会出错误提示
can't load fcgid.pm (有点记不清了)
安装 FCGI
perl -MCPAN -e 'install FCGI'
等一会儿就好了,
新建用户和组
groupadd -g 1000 vmail
useradd -m -g 1000 -s /usr/sbin/nologin -u 1000 vmail
改变extsuite的所有者和组
chown -R vmail:vmai extsuite
启动cgid ./server-init start
ps -aux | grep vmail (没有找到cgid)
[img]http://vip1.taobaz.com/i/81106/01.JPG[/img]
修改nginx.conf
cd /etc/nginx
在nginx.conf http {
                      server{
...................
                } 最后加入location ~ ^/extmail/cgi/.*\.cgi
    {
        proxy_pass [url]http://127.0.0.1:8080[/url];
        proxy_set_header Host $http_host;
        proxy_set_header X-real-IP $remote_addr;
        proxy_buffering off;
    }
[img]http://vip1.taobaz.com/i/81106/02.JPG[/img]
重启nginx
# pkill nginx
# ps -aux | grep nginx
# ./nginx
测试
[img]http://vip1.taobaz.com/i/81106/03.JPG[/img]

liaohuangen 发表于 2010-6-2 11:07

楼主你好

extmail里面用的都是apache啊,没有nginx啊,

liaohuangen 发表于 2010-6-7 15:46

我在apache上面进行配置,发现登陆的时候,总是出现一些小问题,在WEB界面上输入用户名和密码之后,回车,是一个空白的界面,按F5后,界面出来了,提示“你已经登陆了”,旁边有一个链接,点链接,可以进入WEB邮件系统。这个是什么原因呢,在Extmail CGI server上面也不没有错误的日志信息!

希望能出一个在APACHE下面可以用的配置,可以对照一下!

谢谢大家,

页: [1] 2

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.