<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DevOps技术分享 &#187; FCGI</title>
	<atom:link href="http://www.showerlee.com/archives/tag/fcgi/feed" rel="self" type="application/rss+xml" />
	<link>http://www.showerlee.com</link>
	<description>与你共同学习运维开发</description>
	<lastBuildDate>Mon, 19 Oct 2020 05:51:41 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
		<item>
		<title>EXTMAIL增加FCGI支持</title>
		<link>http://www.showerlee.com/archives/307</link>
		<comments>http://www.showerlee.com/archives/307#comments</comments>
		<pubDate>Sat, 24 Aug 2013 05:23:53 +0000</pubDate>
		<dc:creator>showerlee</dc:creator>
				<category><![CDATA[MAIL]]></category>
		<category><![CDATA[EXTMAIL]]></category>
		<category><![CDATA[FCGI]]></category>

		<guid isPermaLink="false">http://www.showerlee.com/?p=307</guid>
		<description><![CDATA[为extmail增加FCGI的支持，主要是为了获得优异的web效能，克服CGI不能应付大量访问及低效率的缺陷。 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">为extmail增加<a href="http://www.showerlee.com/archives/tag/fcgi" title="查看FCGI中的全部文章" class="tag_link">FCGI</a>的支持，主要是为了获得优异的web效能，克服CGI不能应付大量访问及低效率的缺陷。根据我们的测试，CGI模式下的页面效率只有<a href="http://www.showerlee.com/archives/tag/fcgi" title="查看FCGI中的全部文章" class="tag_link">FCGI</a>下的1/10~1/100，因此建议有条件的用户还是使用<a href="http://www.showerlee.com/archives/tag/fcgi" title="查看FCGI中的全部文章" class="tag_link">FCGI</a>。日后</span><a href="http://wiki.extmail.org/extmail"><span style="font-size:14px;font-family:Arial;color:#333333;">ExtMail</span></a><span style="font-size:14px;font-family:Arial;color:#333333;">Solution的web CGI程序将全部都支持<a href="http://www.showerlee.com/archives/tag/fcgi" title="查看FCGI中的全部文章" class="tag_link">FCGI</a>。</span>
</p>
<p>
	
</p>
<p>
	
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">Extmail开发团队花了大量时间重新设计了<a href="http://www.showerlee.com/archives/tag/fcgi" title="查看FCGI中的全部文章" class="tag_link">FCGI</a> server的进程管理模型，并参考了apache的机制，新版dispatch.fcgi 终于可以象apache一样定义max server数，min server（启动进程数）以及每进程服务次数，每进程执行时限等，可较好的利用系统cpu/内存资源，既保证不多占内存，又可保证请求数上升时能有足够进程数服务。</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">就我们搜索发现，目前网上还没有开源版的</span><a href="http://wiki.extmail.org/fastcgi"><span style="font-size:14px;font-family:Arial;color:#333333;">FastCGI</span></a><span style="font-size:14px;font-family:Arial;color:#333333;">&nbsp;server能实现上述自适应负载功能（例如php-fpm还未实现，POE等也未实现），所以Extmail的dispatch.fcgi也许是第一个实现了这个功能。</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">mod_fastcgi 是针对Apache Web服务器的<a href="http://www.showerlee.com/archives/tag/fcgi" title="查看FCGI中的全部文章" class="tag_link">FCGI</a>支持模块</span><br />
<span style="font-size:14px;font-family:Arial;color:#333333;"> 下载地址：&nbsp;</span><a href="http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz"><span style="font-size:14px;font-family:Arial;color:#333333;"><a href="http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz" rel="nofollow">http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz</a></span></a>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">安装mod_fastcgi ：</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;"></span>
</p>
<div>
<div>
<p>
			<span style="font-size:14px;font-family:Arial;color:#333333;">shell</span>
		</p>
<div>
			<span style="font-size:14px;font-family:Arial;color:#333333;"># wget&nbsp;</span><a href="http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz"><span style="font-size:14px;font-family:Arial;color:#333333;"><a href="http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz" rel="nofollow">http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz</a></span></a><br />
<span style="font-size:14px;font-family:Arial;color:#333333;"> # tar xfz mod_fastcgi-2.4.6.tar.gz</span><br />
<span style="font-size:14px;font-family:Arial;color:#333333;"> # cd mod_fastcgi-2.4.6</span><br />
<span style="font-size:14px;font-family:Arial;color:#333333;"> # cp Makefile.AP2 Makefile</span>
		</div>
<div>
			<span style="font-size:14px;font-family:Arial;color:#333333;"># yum install make -y</span>
		</div>
<div>
			<span style="font-size:14px;font-family:Arial;color:#333333;"># yum install httpd-devel -y</span><br />
<span style="font-size:14px;font-family:Arial;color:#333333;"> # make top_dir=/usr/lib64/httpd/ install</span>
		</div>
</p></div>
</div>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">安装perl-<a href="http://www.showerlee.com/archives/tag/fcgi" title="查看FCGI中的全部文章" class="tag_link">FCGI</a> 除了Apache需要FCGI的支持外，extmail也需要相应的perl-FCGI模块。</span>
</p>
<div>
<div>
<p>
			<span style="font-size:14px;font-family:Arial;color:#333333;">shell</span>
		</p>
<div>
			<span style="font-size:14px;font-family:Arial;color:#333333;"># yum install perl-FCGI</span>
		</div>
</p></div>
</div>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">配置虚拟主机：</span>
</p>
<p>
	
</p>
<p>
	
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">shell</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;"># vi /etc/httpd/conf/vhost_extmail.conf</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">#增加内容如下：</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">LoadModule&nbsp;fastcgi_module&nbsp;modules/mod_fastcgi.so&nbsp;&nbsp;</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">&lt;Ifmodule&nbsp;mod_fastcgi.c&gt;&nbsp;</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">FastCgiExternalServer&nbsp;/usr/bin/dispatch.fcgi&nbsp;-host&nbsp;127.0.0.1:8888&nbsp;-idle-timeout&nbsp;240&nbsp;</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">&lt;/Ifmodule&gt;&nbsp;</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">#同时，去掉如下行：&nbsp;</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">#ScriptAlias&nbsp;/extmail/cgi/&nbsp;/var/www/extsuite/extmail/cgi/ &nbsp;&nbsp;</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">#在去掉之行下方添加：&nbsp;</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">Alias&nbsp;/extmail/cgi/&nbsp;/usr/bin/dispatch.fcgi/&nbsp;</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">&lt;Location&nbsp;"/extmail/cgi"&gt;&nbsp;</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">SetHandler&nbsp;fastcgi-script&nbsp;</span>
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">&lt;/Location&gt;&nbsp;</span>
</p>
<p>
	
</p>
<p>
	
</p>
<p>
	
</p>
<p>
	<span style="font-size:14px;font-family:Arial;color:#333333;">重启Apache和fastcgi server开机自启动：</span>
</p>
<div>
<div>
<p>
			<span style="font-size:14px;font-family:Arial;color:#333333;">shell</span>
		</p>
<div>
			<span style="font-size:14px;font-family:Arial;color:#333333;"># service httpd restart</span><br />
<span style="font-size:14px;font-family:Arial;color:#333333;"> # /var/www/extsuite/extmail/dispatch-init start</span><br />
<span style="font-size:14px;font-family:Arial;color:#333333;"> # echo '/var/www/extsuite/extmail/dispatch-init start' &gt;&gt; /etc/rc.d/rc.local</span>
		</div>
</p></div>
</div>
<p>
	
</p>
<p>
	
</p>
<p></p>
<div>声明: 本文采用 <a rel="external" href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="署名-非商业性使用-相同方式共享 3.0 Unported">CC BY-NC-SA 3.0</a> 协议进行授权</div><div>转载请注明来源：<a rel="external" title="DevOps技术分享" href="http://www.showerlee.com/archives/307">DevOps技术分享</a></div><div>本文链接地址：<a rel="external" title="EXTMAIL增加FCGI支持" href="http://www.showerlee.com/archives/307">http://www.showerlee.com/archives/307</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.showerlee.com/archives/307/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
