信仰

猛图www.omeng.org

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1:因为需要做一个整合的项目,需要用到nginx,所以将基本的django配置记了下来希望对大家有用你也可以再这里给我留言,我会尽量给你答复。

2:在下面步骤之前,需要安装一些基本的东西 django nginx  flup等等,在此就不一一贴出来了。

1 #user nobody;
2  worker_processes 1;
3
4  #error_log logs/error.log;
5 #error_log logs/error.log notice;
6 #error_log logs/error.log info;
7  
8  #pid logs/nginx.pid;
9  
10
11 events {
12 worker_connections 1024;
13 }
14
15
16 http {
17 include mime.types;
18 default_type application/octet-stream;
19 log_format main '$remote_addr - $remote_user [$time_local] '
20 '"$request" $status $bytes_sent '
21 '"$http_referer" "$http_user_agent" '
22 '"$gzip_ratio"';
23 client_header_timeout 3m;
24 client_body_timeout 3m;
25 send_timeout 3m;
26 connection_pool_size 256;
27 client_header_buffer_size 1k;
28 large_client_header_buffers 4 2k;
29 request_pool_size 4k;
30 output_buffers 4 32k;
31 postpone_output 1460;
32 sendfile on;
33 tcp_nopush on;
34 keepalive_timeout 75 20;
35 tcp_nodelay on;
36 client_max_body_size 10m;
37 client_body_buffer_size 256k;
38 proxy_connect_timeout 90;
39 proxy_send_timeout 90;
40 proxy_read_timeout 90;
41 client_body_temp_path temp/client_body_temp;
42 proxy_temp_path temp/proxy_temp;
43 fastcgi_temp_path temp/fastcgi_temp;
44 gzip on;
45 gzip_min_length 1100;
46 gzip_buffers 4 32k;
47 gzip_types text/plain text/html application/x-javascript text/xml text/css;
48 ignore_invalid_headers on;
49
50 server {
51 listen 80;
52 server_name www.panyuan.com;
53
54 #charset koi8-r;
55  
56 #access_log logs/host.access.log main;
57  
58 location / {
59 root html/daybang;
60 fastcgi_pass 127.0.0.1:8080;
61 fastcgi_param PATH_INFO $fastcgi_script_name;
62 fastcgi_param REQUEST_METHOD $request_method;
63 fastcgi_param QUERY_STRING $query_string;
64 fastcgi_param CONTENT_TYPE $content_type;
65 fastcgi_param CONTENT_LENGTH $content_length;
66 fastcgi_pass_header Authorization;
67 fastcgi_param REMOTE_ADDR $remote_addr;
68 fastcgi_param SERVER_PROTOCOL $server_protocol;
69 fastcgi_param SERVER_PORT $server_port;
70 fastcgi_param SERVER_NAME $server_name;
71 fastcgi_intercept_errors off;
72 }
73
74 location ^~ /static/ {
75 alias html/daybang/static/;
76 }
77
78 location ^~ /medias/ {
79 alias html/daybang/medias/;
80 }
81
82 location ^~ /media/ {
83 alias C:/Python26/Lib/site-packages/django/contrib/admin/media/;
84 }
85
86 #error_page 404 /404.html;
87  
88 # redirect server error pages to the static page /50x.html
89   #
90   error_page 500 502 503 504 /50x.html;
91 location = /50x.html {
92 root html;
93 }
94
95 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
96   #
97 #location ~ \.php$ {
98 # proxy_pass http://127.0.0.1;
99 #}
100
101 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
102 #
103 #location ~ \.php$ {
104 # root html;
105 # fastcgi_pass 127.0.0.1:9000;
106 # fastcgi_index index.php;
107 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
108 # include fastcgi_params;
109 #}
110
111 # deny access to .htaccess files, if Apache's document root
112 # concurs with nginx's one
113 #
114 #location ~ /\.ht {
115 # deny all;
116 #}
117
118 }
119
120
121 # another virtual host using mix of IP-, name-, and port-based configuration
122 #
123 server {
124 listen 80;
125 # #listen manager.panyuan.com;
126 server_name manager.panyuan.com;
127
128 location / {
129 root html/manager;
130 fastcgi_pass 127.0.0.1:8181;
131 fastcgi_param PATH_INFO $fastcgi_script_name;
132 fastcgi_param REQUEST_METHOD $request_method;
133 fastcgi_param QUERY_STRING $query_string;
134 fastcgi_param CONTENT_TYPE $content_type;
135 fastcgi_param CONTENT_LENGTH $content_length;
136 fastcgi_pass_header Authorization;
137 fastcgi_param REMOTE_ADDR $remote_addr;
138 fastcgi_param SERVER_PROTOCOL $server_protocol;
139 fastcgi_param SERVER_PORT $server_port;
140 fastcgi_param SERVER_NAME $server_name;
141 fastcgi_intercept_errors off;
142 }
143
144 location ^~ /site_media/ {
145 alias html/manager/medias/;
146 }
147
148 location ^~ /media/ {
149 alias C:/Python26/Lib/site-packages/django/contrib/admin/media/;
150 }
151
152
153 }
154
155
156 # HTTPS server
157 #
158 #server {
159 # listen 443;
160 # server_name localhost;
161
162 # ssl on;
163 # ssl_certificate cert.pem;
164 # ssl_certificate_key cert.key;
165
166 # ssl_session_timeout 5m;
167
168 # ssl_protocols SSLv2 SSLv3 TLSv1;
169 # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
170 # ssl_prefer_server_ciphers on;
171
172 # location / {
173 # root html;
174 # index index.html index.htm;
175 # }
176 #}
177
178 }
179

2: CMd运行 

C:\nginx\html\daybang>manage.py runfcgi method=threaded host=127.0.0.1 port=8080 --settings=settings

3:http://www.panyuan.com/

代码

It worked!
Congratulations on your first Django
-powered page.

Of course, you haven
't actually done any work yet. Here's what to do next:

* If you plan to use a database, edit the DATABASE_* settings in daybang/settings.py.
* Start your first app by running python daybang/manage.py startapp [appname].

You
're seeing this message because you have DEBUG = True in your Django settings file and you haven't configured any URLs. Get to work!
posted on 2010-05-01 20:04  信仰123  阅读(2495)  评论(0编辑  收藏  举报

猛图