Django with nginx

聽說效能比較好,聽說安全性不錯,聽說記憶體用很少

聽別人說不準,還是自己試試才知道

所以單純只是試試試看,跑起來如何,自己寫個筆記

我的nginx上, server 設定,Django fastcgi 的部份照舊 ,如果跟我一樣是用 unix socket 來連的話,權限要可以讓 nginx 寫入


limit_zone one $binary_remote_addr 10m;
server {
listen 80;
server_name s.localhost.com h.localhost.com;
#server_name home.digez.com stock.digez.com;

access_log /var/log/nginx/access.log;
location /site_media {
alias /home/terry/media/;
}
location /media {
alias /home/terry/django_src/django/contrib/admin/media/;
}
location / {
#fastcgi_pass 127.0.0.1:8080;
fastcgi_pass unix:/home/terry/run/digez.sock;
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 REMOTE_ADDR $remote_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
limit_conn one 5;
}

}


更新
2010-01-05 設定加入, fastcgi_param REMOTE_ADDR $remote_addr; Django 需要

相關連結
Django
nginx
參考資料
http://wiki.nginx.org/Main

http://stackoverflow.com/questions/605173/how-to-nginx-virtual-servers-fcgi-for-django

http://david-paste.cn/paste/20/

http://stackoverflow.com/questions/605173/how-to-nginx-virtual-servers-fcgi-for-django

comments powered by Disqus