标题:Centos+lighttpd+flup+fastcgi+django 出处:运维进行时 时间:Thu, 22 May 2008 16:51:11 +0000 作者:root 地址:https://blog.liuts.com/post/104/ 内容: 一、安装lighttpd、django略 二、安装flup 引用 wget -c http://www.saddi.com/software/flup/dist/flup-0.5.tar.gz tar xzvf flup-0.5.tar.gz cd flup-0.5 python setup.py install 提示: --------------------------------------- The required version of setuptools (>=0.6c6) is not available, and can't be installed while this script is running. Please install a more recent version first. (Currently using setuptools 0.6c5 (/usr/local/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg)) --------------------------------------- 原因是我的setuptools的版本过低。 wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c6-py2.5.egg chmod +x setuptools-0.6c6-py2.5.egg ./setuptools-0.6c6-py2.5.egg 再安装flup python setup.py install 搞定:) 三、编写fastcgi shell web目录:/www/mysite cd /www/mysite vi django.fcgi ----------------------------------------------------- #!/usr/bin/python import sys, os sys.path.insert(0, "/usr/local/bin/python") os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings" from django.core.servers.fastcgi import runfastcgi runfastcgi(method="threaded", daemonize="false") 四、配置lighttpd server.modules = ( "mod_access", "mod_alias", "mod_fastcgi", "mod_accesslog", "mod_rewrite", # "mod_redirect", # "mod_status", # "mod_evhost", ............ url.rewrite-once = ( "^(/media.*)$" => "$1", "^(/.*)$" => "/django.fcgi$1" ) server.document-root = "/www/mysite" fastcgi.server = ( "/django.fcgi" =>( "main" =>( "host" => "127.0.0.1" , "port" => 3033, ) ), ) 五、运行 引用 1、/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/etc/lighttpd.conf 2、cd /www/mysite python ./manage.py runfcgi method=threaded host=127.0.0.1 port=3033 Generated by Bo-blog 2.1.1 Release