Django on Nginx

来自开放百科 - 灰狐
2009年3月8日 (日) 10:31Allen (讨论 | 贡献)的版本

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到: 导航, 搜索

nginx.conf

upstream djangoserv {
server 127.0.0.1:8801;
}
server {
listen 80;
root /path/to/app;
server_name test.local.domain;
access_log /path/to/logs/appname-access.log main;
error_log /path/to/logs/appname-error.log;
location /styles  { 
	root /path/to/styles;
}
location /javascripts  {
	root /path/to/javascripts;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov) {
        access_log   off;
        expires      30d; 
}
location / {
                        # host and port to fastcgi server
                        fastcgi_pass 127.0.0.1:8801;
                        fastcgi_param PATH_INFO $fastcgi_script_name;
                        fastcgi_param REQUEST_METHOD $request_method;
                        fastcgi_param QUERY_STRING $query_string;
                        fastcgi_param SERVER_NAME $server_name;
                        fastcgi_param SERVER_PORT $server_port;
                        fastcgi_param SERVER_PROTOCOL $server_protocol;
                        fastcgi_param CONTENT_TYPE $content_type;
                        fastcgi_param CONTENT_LENGTH $content_length;
                        fastcgi_pass_header Authorization;
                        fastcgi_intercept_errors off;
} 
}

start your nginx fastcgi processes

python2.5 manage.py runfcgi method=threaded host=127.0.0.1 port=8801
分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱