<?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; dajngo</title>
	<atom:link href="http://blog.declab.com/tag/dajngo/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作为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>
