<?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>阿债的山寨实验室 &#187; fcgi</title>
	<atom:link href="http://blog.declab.com/tag/fcgi/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.declab.com</link>
	<description></description>
	<lastBuildDate>Thu, 27 May 2010 03:45:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Nginx作为PHP的Web服务器</title>
		<link>http://blog.declab.com/server/2008/linux%e7%9a%84%e6%97%b6%e9%97%b4%e4%b8%8e%e6%97%b6%e5%8c%ba%e8%ae%be%e7%bd%ae/</link>
		<comments>http://blog.declab.com/server/2008/linux%e7%9a%84%e6%97%b6%e9%97%b4%e4%b8%8e%e6%97%b6%e5%8c%ba%e8%ae%be%e7%bd%ae/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 17:52:17 +0000</pubDate>
		<dc:creator>阿债</dc:creator>
				<category><![CDATA[服务器管理]]></category>
		<category><![CDATA[fcgi]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://rblog.declab.com/2008/1/linux%e7%9a%84%e6%97%b6%e9%97%b4%e4%b8%8e%e6%97%b6%e5%8c%ba%e8%ae%be%e7%bd%ae/</guid>
		<description><![CDATA[PHP可以以两种方式工作，一种module的方式，另一种是CGI的方式。我们现在就是让它采用后一种方式工作。 先要下载一大堆包，我们把这些全部安装到/usr/local/share/的子目录里 curl-7.18.1 freetype-2.3.5 jpeg6b libiconv-1.1.2 libmcrypt-2.5.7 libpng-1.2.25 libxml2-2.6.3 zlib-1.2.3 安装方法都一样： tar xzvf ****-*.*.*.tar.gz cd ****-*.*.* ./configure --prefix=/usr/local/share/****-*.*.* make make install 安装PHP的CGI模式 tar xzvf php-5.2.5.tar.gz cd php-5.2.5 ./configure --prefix=/usr/local/php-5.2.5 --with-config-file-path=/usr/local/php-5.2.5/etc \ --with-mysql=/usr/local/mysql-5.0 --with-iconv-dir=/usr/local/share/libiconv-1.1.2 \ --with-freetype-dir=/usr/local/share/freetype-2.3.5 --with-jpeg-dir=/usr/local/share/jpeg6b \ --with-png-dir=/usr/local/share/libpng-1.2.25 --with-zlib=/usr/local/share/zlib-1.2.3 \ --with-libxml-dir=/usr/local/share/libxml-2.6.3 --enable-xml --disable-debug --disable-rpath \ --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem \ --enable-inline-optimization --with-curl=/usr/local/share/curl-7.18.1 --with-curlwrappers \ [...]


No related posts.

以上关联文章由 <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a> 提供支持。]]></description>
			<content:encoded><![CDATA[<p>PHP可以以两种方式工作，一种module的方式，另一种是CGI的方式。我们现在就是让它采用后一种方式工作。<br />
<span id="more-6"></span><br />
先要下载一大堆包，我们把这些全部安装到/usr/local/share/的子目录里<br />
curl-7.18.1<br />
freetype-2.3.5<br />
jpeg6b<br />
libiconv-1.1.2<br />
libmcrypt-2.5.7<br />
libpng-1.2.25<br />
libxml2-2.6.3<br />
zlib-1.2.3<br />
安装方法都一样：</p>
<pre lang="bash" line="1">tar xzvf ****-*.*.*.tar.gz
cd ****-*.*.*
./configure --prefix=/usr/local/share/****-*.*.*
make
make install</pre>
<p>安装PHP的CGI模式</p>
<pre lang="bash" line="1">tar xzvf php-5.2.5.tar.gz
cd php-5.2.5
./configure --prefix=/usr/local/php-5.2.5 --with-config-file-path=/usr/local/php-5.2.5/etc \
  --with-mysql=/usr/local/mysql-5.0 --with-iconv-dir=/usr/local/share/libiconv-1.1.2 \
  --with-freetype-dir=/usr/local/share/freetype-2.3.5 --with-jpeg-dir=/usr/local/share/jpeg6b \
  --with-png-dir=/usr/local/share/libpng-1.2.25 --with-zlib=/usr/local/share/zlib-1.2.3 \
  --with-libxml-dir=/usr/local/share/libxml-2.6.3 --enable-xml --disable-debug --disable-rpath \
  --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem \
  --enable-inline-optimization --with-curl=/usr/local/share/curl-7.18.1 --with-curlwrappers \
  --enable-mbregex --enable-fastcgi --enable-force-cgi-redirect --enable-mbstring \
  --with-mcrypt=/usr/local/share/libmcrypt-2.5.7
make
make install</pre>


<p>No related posts.</p>
<p>以上关联文章由 <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a> 提供支持。</p>]]></content:encoded>
			<wfw:commentRss>http://blog.declab.com/server/2008/linux%e7%9a%84%e6%97%b6%e9%97%b4%e4%b8%8e%e6%97%b6%e5%8c%ba%e8%ae%be%e7%bd%ae/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux下安装PHP为CGI模式</title>
		<link>http://blog.declab.com/server/2008/linux%e4%b8%8b%e5%ae%89%e8%a3%85php%e4%b8%bacgi%e6%a8%a1%e5%bc%8f/</link>
		<comments>http://blog.declab.com/server/2008/linux%e4%b8%8b%e5%ae%89%e8%a3%85php%e4%b8%bacgi%e6%a8%a1%e5%bc%8f/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 12:01:11 +0000</pubDate>
		<dc:creator>阿债</dc:creator>
				<category><![CDATA[服务器管理]]></category>
		<category><![CDATA[fcgi]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://rblog.declab.com/2008/1/linux%e4%b8%8b%e5%ae%89%e8%a3%85php%e4%b8%bacgi%e6%a8%a1%e5%bc%8f/</guid>
		<description><![CDATA[首先安装好Nginx和PHP(CGI模式)，请参考另外两篇日志。 在nginx配置文件，我的系统里面是 /usr/local/nginx-0.5.3/conf/nginx.conf 的server内添加如下配置 location ~ \.php$ { fastcgi_pass localhost:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/website$fastcgi_script_name; include conf/fastcgi.conf; } 其中9000是我的php-cgi与nginx通讯的端口，/usr/local/website是我的网站根目录 创建/usr/local/nginx-0.5.3/conf/fastcgi.conf文件，内容如下： fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param REMOTE_ADDR [...]


No related posts.

以上关联文章由 <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a> 提供支持。]]></description>
			<content:encoded><![CDATA[<p>首先安装好Nginx和PHP(CGI模式)，请参考另外两篇日志。</p>
<p>在nginx配置文件，我的系统里面是 /usr/local/nginx-0.5.3/conf/nginx.conf<br />
的server内添加如下配置<br />
<span id="more-7"></span></p>
<pre lang="bash" line="1">location ~ \.php$ {
  fastcgi_pass   localhost:9000;
  fastcgi_index  index.php;
  fastcgi_param  SCRIPT_FILENAME  /usr/local/website$fastcgi_script_name;
  include        conf/fastcgi.conf;
}</pre>
<p>其中9000是我的php-cgi与nginx通讯的端口，/usr/local/website是我的网站根目录</p>
<p>创建/usr/local/nginx-0.5.3/conf/fastcgi.conf文件，内容如下：</p>
<pre lang="bash" line="1">fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;</pre>
<p>(以上部分参考 http://blog.codefront.net/2007/06/11/nginx-php-and-a-php-fastcgi-daemon-init-script/)</p>
<p>从lighttpd中得到二进制的 spawn-cgi 文件，我把它放在 /usr/local/php-5.2.5/bin下<br />
建立php-cgi到nginx的通道 /usr/local/php-5.2.5/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www -f /usr/local/php-5.2.5/bin/php-cgi<br />
重启nginx，就可以了<br />
(以上部分参考 http://www.linuxdiyf.com/bbs/redirect.php?tid=76830&#038;goto=lastpost<br />
与 http://blog.s135.com/read.php/314.htm)</p>
<p>其他参考：</p>
<p>http://wiki.codemongers.com/NginxFcgiExample</p>


<p>No related posts.</p>
<p>以上关联文章由 <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a> 提供支持。</p>]]></content:encoded>
			<wfw:commentRss>http://blog.declab.com/server/2008/linux%e4%b8%8b%e5%ae%89%e8%a3%85php%e4%b8%bacgi%e6%a8%a1%e5%bc%8f/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nginx作为Django的Web服务器</title>
		<link>http://blog.declab.com/server/2008/nginx%e4%bd%9c%e4%b8%badjango%e7%9a%84web%e6%9c%8d%e5%8a%a1%e5%99%a8/</link>
		<comments>http://blog.declab.com/server/2008/nginx%e4%bd%9c%e4%b8%badjango%e7%9a%84web%e6%9c%8d%e5%8a%a1%e5%99%a8/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 16:22:10 +0000</pubDate>
		<dc:creator>阿债</dc:creator>
				<category><![CDATA[服务器管理]]></category>
		<category><![CDATA[dajngo]]></category>
		<category><![CDATA[fcgi]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://rblog.declab.com/2008/1/nginx%e4%bd%9c%e4%b8%badjango%e7%9a%84web%e6%9c%8d%e5%8a%a1%e5%99%a8/</guid>
		<description><![CDATA[我有一个用Django写的网站，放在/usr/local/website，我想用nginx作Web服务器。 1. nginx依赖于pcre，下载和安装pcre7.6 tar xzvf pcre-7.6.tar.gz cd pcre-7.6 ./configure --prefix=/usr/local/share/pcre-7.6 make make install 2.下载和安装nginx0.5.3 tar xzvf nginx-0.5.3.tar.gz cd nginx-0.5.3 ./configure --prefix=/usr/local/nginx-0.5.3 --with-pcre=/root/pcre-7.6 make make install 注意，这里的&#8211;with-pcre是pcre源码的目录 3. 下载和安装flup1.0 tar xzvf flup-1.0.tar.gz cd flup-1.0 python setup.py install 4. 配置nginx nginx.conf的配置 #search and replace this: /usr/local/website #PROJECT_PATH = '/usr/local/website' #NGINX_PATH = '/usr/local/nginx-0.5.3' pid /usr/local/website/log/nginx.pid; worker_processes 2; error_log [...]


No related posts.

以上关联文章由 <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a> 提供支持。]]></description>
			<content:encoded><![CDATA[<p>我有一个用Django写的网站，放在/usr/local/website，我想用nginx作Web服务器。<br />
<span id="more-5"></span><br />
1. nginx依赖于pcre，下载和安装pcre7.6</p>
<pre lang="bash" line="1">tar xzvf pcre-7.6.tar.gz
cd pcre-7.6
./configure  --prefix=/usr/local/share/pcre-7.6
make
make install</pre>
<p>2.下载和安装nginx0.5.3</p>
<pre lang="bash" line="1">tar xzvf nginx-0.5.3.tar.gz
cd nginx-0.5.3
./configure  --prefix=/usr/local/nginx-0.5.3 --with-pcre=/root/pcre-7.6
make
make install</pre>
<p>注意，这里的&#8211;with-pcre是pcre源码的目录</p>
<p>3. 下载和安装flup1.0</p>
<pre lang="bash" line="1">tar xzvf flup-1.0.tar.gz
cd flup-1.0
python setup.py install</pre>
<p>4. 配置nginx<br />
nginx.conf的配置</p>
<pre lang="bash" line="1">#search and replace this: /usr/local/website
#PROJECT_PATH = '/usr/local/website'
#NGINX_PATH = '/usr/local/nginx-0.5.3'

pid /usr/local/website/log/nginx.pid;
worker_processes  2;
error_log /usr/local/website/log/error_log;
events {
    worker_connections  1024;
    use epoll;
}
http {
    # default nginx location
    include        /usr/local/nginx-0.5.3/conf/mime.types;
    default_type    application/octet-stream;
    log_format main
        '$remote_addr - $remote_user [$time_local] '
            '"$request" $status $bytes_sent '
        '"$http_referer" "$http_user_agent" '
        '"$gzip_ratio"';
    client_header_timeout  3m;
    client_body_timeout    3m;
    send_timeout           3m;
    connection_pool_size        256;
    client_header_buffer_size    1k;
    large_client_header_buffers    4 2k;
    request_pool_size        4k;
    output_buffers   4 32k;
    postpone_output  1460;
    sendfile        on;
    tcp_nopush             on;
    keepalive_timeout      75 20;
    tcp_nodelay            on;
    client_max_body_size       10m;
    client_body_buffer_size    256k;
    proxy_connect_timeout      90;
    proxy_send_timeout         90;
    proxy_read_timeout         90;
    client_body_temp_path      /usr/local/website/log/client_body_temp;
    proxy_temp_path            /usr/local/website/log/proxy_temp;
    fastcgi_temp_path          /usr/local/website/log/fastcgi_temp;
    gzip on;
    gzip_min_length  1100;
    gzip_buffers     4 32k;
    gzip_types       text/plain text/html application/x-javascript text/xml text/css;
    ignore_invalid_headers    on;
    server {
        listen 8000;
        server_name localhost;
        index index.html;
        root   /usr/local/website;
        # static resources
        location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
        {
                expires 30d;
                break;
        }
        location / {
            # host and port to fastcgi server
            fastcgi_pass unix:/usr/local/website/log/django.sock;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param REQUEST_METHOD $request_method;
            fastcgi_param QUERY_STRING $query_string;
            fastcgi_param CONTENT_TYPE $content_type;
            fastcgi_param CONTENT_LENGTH $content_length;
            fastcgi_pass_header Authorization;
            fastcgi_intercept_errors off;
        }
        location /403.html {
                root   ./;
                access_log   off;
        }
        location /401.html {
                root   ./;
                access_log   off;
        }
        location /404.html {
                root   ./;
                access_log   off;
        }
        location = /_.gif {
                    empty_gif;
                access_log   off;
        }
            access_log    /usr/local/website/log/localhost.access_log main;
            error_log    /usr/local/website/log/localhost.error_log;
        }
}</pre>
<p>5. django以fcgi方式启动的脚本：</p>
<pre lang="bash" line="1">#Django fastcgi start sh:
#PROJECT_PATH = '/usr/local/website'
#PROJECT_NAME = 'website'
cd /usr/local/website
python ./manage.py runfcgi --settings=website.settings maxchildren=10 \
maxspare=5 minspare=2 method=prefork socket=/usr/local/website/log/django.sock pidfile=/usr/local/website/log/django.pid</pre>


<p>No related posts.</p>
<p>以上关联文章由 <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a> 提供支持。</p>]]></content:encoded>
			<wfw:commentRss>http://blog.declab.com/server/2008/nginx%e4%bd%9c%e4%b8%badjango%e7%9a%84web%e6%9c%8d%e5%8a%a1%e5%99%a8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
