Jun 23, 2011

nginx+fastcgi+django

nginx 配置
location ~ ^/static/(.*)$ {
            alias e:/webapp/crown/site_media/$1;
        } 
 
        location / {
            # 指定 fastcgi 的主机和端口
            fastcgi_pass 127.0.0.1:8051;
            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_param SERVER_PROTOCOL $server_protocol;
            fastcgi_param SERVER_PORT $server_port;
            fastcgi_param SERVER_NAME $server_name;
            fastcgi_pass_header Authorization;
            fastcgi_intercept_errors off;
        }

安装 flup: pip install flup

django
python manage.py runfcgi method=threaded host=127.0.0.1 port=8051

0 comments: