<?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>Life - WeiG &#187; cgi</title>
	<atom:link href="http://www.weigblog.com/tag/cgi/feed" rel="self" type="application/rss+xml" />
	<link>http://www.weigblog.com</link>
	<description>Yet another Life</description>
	<lastBuildDate>Thu, 05 Jan 2012 03:13:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>在Nginx下运行perl-cgi脚本</title>
		<link>http://www.weigblog.com/2009/09/16/using-per-cgi-in-nginx.html</link>
		<comments>http://www.weigblog.com/2009/09/16/using-per-cgi-in-nginx.html#comments</comments>
		<pubDate>Wed, 16 Sep 2009 14:26:37 +0000</pubDate>
		<dc:creator>Wei</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[cgi]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[pl]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.weigblog.com/?p=487</guid>
		<description><![CDATA[把Web Server更换为Nginx后，发现BugZilla不能用了。打开网站显示403 Forbidden，想来是因为BugZilla使用Perl CGI运行的原因。查了Nginx为数不多的文档，发现Nginx不能像其他Web Server（例如Apache）那样直接运行perl-cgi的脚本。 试用几个不同的方法后，发现确实有方法可以比较简单的实现perl-cgi的功能： 首先下载一个Perl Wrapper，我把它另存为~/perl-fastcgi.pl。 修改perl-fastcgi.pl的属性，添加可执行权限。运行该文件，该脚本会创建一个/var/run/nginx/perl_cgi-dispatch.sock文件。 修改nginx的配置文件，在server section中添加： 配置工作就此完成，重新启动nginx即可。 对于BugZilla，可能还需要运行http://domain.tld/testagent.cgi。]]></description>
			<content:encoded><![CDATA[<p>把Web Server更换为Nginx后，发现BugZilla不能用了。打开网站显示403 Forbidden，想来是因为BugZilla使用Perl CGI运行的原因。查了Nginx为数不多的文档，发现Nginx不能像其他Web Server（例如Apache）那样直接运行perl-cgi的脚本。</p>
<p>试用几个不同的方法后，发现确实有方法可以比较简单的实现perl-cgi的功能：</p>
<p>首先下载一个<a href="http://technotes.1000lines.net/fastcgi-wrapper.pl">Perl Wrapper</a>，我把它另存为~/perl-fastcgi.pl。</p>
<p>修改perl-fastcgi.pl的属性，添加可执行权限。运行该文件，该脚本会创建一个/var/run/nginx/perl_cgi-dispatch.sock文件。</p>
<p>修改nginx的配置文件，在server section中添加：</p>
<pre class="brush: bash; title: ; notranslate">
location ~ \.cgi$ {
        root           /srv/www/domain.tld/public_html;
        fastcgi_pass    unix:/var/run/nginx/perl_cgi-dispatch.sock;
        fastcgi_index   index.cgi;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include         fastcgi_params;
}
</pre>
<p>配置工作就此完成，重新启动nginx即可。</p>
<p>对于BugZilla，可能还需要运行http://domain.tld/testagent.cgi。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weigblog.com/2009/09/16/using-per-cgi-in-nginx.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

