写于<7月 30, 2008, 位置:
http://www.funcat.cn/blog/archives/166
终于配置好了环境, 可以当作production server了.
下面是笔记:
由于Debian下Python2.5更新会有问题, 所以我沿用原有的2.4.
1. 先下载lighttpd的源码:
wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz
2. 解压….
3. 安装几个必要的包: aptitude install libpcre3-dev zlib1g-dev aptitude install libbzip2-dev(似乎是这个名字…记不得了)
aptitude install python-flup
4. 到lighttpd目录下, ./configure make & make install
5. 我没有update-rc.d, 就把所有的东西放到 /usr/local/sbin/下了. 从doc下cp一个lighttpd.conf出来. cp doc/lighttpd.conf /usr/loca/sbin/
6. 修改lighttpd.conf文件:
a. 在server.modules部分, 反注释: mod_rewrite, mod_fastcgi.
b. 修改server.document-root 为 /var/www/ (我的做法.)
c. static-file.exclude-extension = (”.py”, “.pl”, “.fcgi”);
d. 关键部分, 添加:
- fastcgi.server = (
- “.py”=>(
- “localhost”=>( “socket”=>”/tmp/fastcgi.socket”, “bin-path”=>”/var/www/main.py”, “min-procs”=>1 )
- )
- )
e.并且加上
rewrite: server.rewrite-once = ( “^/(.*)$”=>”/main.py/$1″ )
记住, 一定要在main.py顶上加: #!/usr/bin/python