欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2/Agda, C++/Lisp/Haskell
Django on Nginx
来自开放百科 - 灰狐
(版本间的差异)
| 第1行: | 第1行: | ||
| + | apt-get install python-flup | ||
nginx.conf | nginx.conf | ||
upstream djangoserv { | upstream djangoserv { | ||
| − | server 127.0.0.1: | + | server 127.0.0.1:8000; |
} | } | ||
server { | server { | ||
listen 80; | listen 80; | ||
| − | root / | + | root /home/allen/app; |
| − | server_name | + | server_name localhost; |
| − | access_log / | + | access_log /home/allen/app/logs/appname-access.log main; |
| − | error_log / | + | error_log /home/allen/app/logs/appname-error.log; |
location /styles { | location /styles { | ||
| − | root / | + | root /home/allen/app/styles; |
} | } | ||
location /javascripts { | location /javascripts { | ||
| − | root / | + | root /home/allen/app/javascripts; |
} | } | ||
| 第27行: | 第28行: | ||
location / { | location / { | ||
# host and port to fastcgi server | # host and port to fastcgi server | ||
| − | fastcgi_pass 127.0.0.1: | + | fastcgi_pass 127.0.0.1:8000; |
fastcgi_param PATH_INFO $fastcgi_script_name; | fastcgi_param PATH_INFO $fastcgi_script_name; | ||
fastcgi_param REQUEST_METHOD $request_method; | fastcgi_param REQUEST_METHOD $request_method; | ||
| 第41行: | 第42行: | ||
} | } | ||
start your nginx fastcgi processes | start your nginx fastcgi processes | ||
| − | python2.5 manage.py runfcgi method=threaded host=127.0.0.1 port= | + | python2.5 manage.py runfcgi method=threaded host=127.0.0.1 port=8000 |
2009年3月8日 (日) 10:40的版本
apt-get install python-flup
nginx.conf
upstream djangoserv {
server 127.0.0.1:8000;
}
server {
listen 80;
root /home/allen/app;
server_name localhost;
access_log /home/allen/app/logs/appname-access.log main;
error_log /home/allen/app/logs/appname-error.log;
location /styles {
root /home/allen/app/styles;
}
location /javascripts {
root /home/allen/app/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:8000;
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=8000
分享您的观点