10步完成freebsd下 python+django+fastcgi+lighttpd+sqlite3 源码安装与配置.
来源:互联网 发布:icq聊天软件 编辑:程序博客网 时间:2024/06/05 09:21
本文章作者寒玉轩,可任意转载。
转载时请注明:来自:
htdocs.org 作者:寒玉轩
今日将vm虚拟服务器重新搞了一遍~系统换成了freebsd6.2
WEB服务器换成了lighttpd 感觉apache实在是太重的东西了。
python2.5+django0.96 全是最新的。
由于是lighttpd,当然选择fastcgi与django通讯咯~~
数据库是sqlite-3.3.13, 本想用3.4.0的。但不知道为什么
在freebsd6.2下始终编译不成功~ google了半天也没找到答案~ 难道是太新了?嘿~
1.最小话安装freebsd6.2 ........(以后再写。会有插图哦!)htdocs.org 作者:寒玉轩
2.sqlite3 : pysqlite2还没有支持python2.5,而python2.5又整合了sqlite3~
所以我们需要先安装sqlite3 以便安装python2.5时激活这个连接模块。
#tar zxvf sqlite-3.3.13.tar.gz
#cd sqlite-3.3.13
#./configure (缺省路径是/usr/local)
#make
#make install
3.python2.5:
没什么特殊要求默认就好咯
#tar zxvf python-2.5.tar.gz
#cd python-2.5
#./configure
#make
#make install
4.django-0.96:
#tar zxvf django-0.96.tar.gz
#cd django-0.96
#python setup.py install
cd到一个合适的地方~然后:
#django-admin.py startproject test1 (建立了一个名为"test1"的django站点。)
5.pcre-7.1
由于lighttpd 的 rewrite 是需要用到pcre正则。 为了lighttpd安装的时候可以激活mod_rewrite模块~ 我们需要先安装pcre-7.1。
#tar zxvf pcre-7.1.tar.gz
#cd pcre-7.1
#./configure
#make
#make install
6.lighttpd-1.4.13
#tar zxvf lighttpd-1.4.13.tar.gz
#cd lighttpd-1.4.13
#./configure --prefix=/usr/local/lighttpd (缺省为/usr/local)
#make
#make install
#cp doc/lighttpd.conf /usr/local/lighttpd (lighttpd 配置文件)
7.flup-0.5 htdocs.org 作者:寒玉轩
lighttpd默认已经整合了mod_fastcgi~ 所以我们只须安装flup.
#tar zxvf flup-0.5.tar.gz
#cd flup-0.5
#python setup.py install
8.建立fcgi文件
lighttpd 运行django 是通过fcgi文件的 所以我们要在站点的根目录下建力一个test1.fcgi文件(假设站点名称为test1)
文件内容如下:(不可照搬,需按照不同路径,不同站点名以及不同的功能需求做相应的更改。)
#!/usr/bin/python
import sys, os
# Add a custom Python path.
sys.path.insert(0, "/usr/local/bin/python")
# Switch to the directory of your project. (Optional.)
# os.chdir("/usr/htdocs/test1")
# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "test1.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
记得修改执行权限: #chmod +x manage.py
启动FCGI:
#/usr/htdocs/test1/manage.py runfcgi method=prefork socket=/tmp/test1.sock pidfile=django.pid
9.修改 lighttpd.conf : htdocs.org 作者:寒玉轩
(不可照搬,按不同路径,不同功能 不同站点名做相应的更改。)
server.modules = (
"mod_rewrite",
"mod_redirect",
"mod_evasive",
"mod_alias",
"mod_access",
"mod_fastcgi",
# "mod_expire",
# "mod_compress",
"mod_accesslog"
)
mimetype.assign = (
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".css" => "text/css",
".js" => "text/javascript"
)
server.document-root = "/usr/htdocs/test1" #此路径用来放置.fcgi文件。
fastcgi.server = (
"/test1.fcgi" => (
"main" => (
"socket" => "/tmp/test1.sock",
"check-local" => "disable"
)
)
)
url.rewrite = (
"^(/site_media/.*)$" => "$1",
"^(/.*)$" => "/test1.fcgi$1"
)
10.启动lighttpd htdocs.org 作者:寒玉轩
#/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/lighttpd.conf
----------------------------------------------------------------------------------
呵呵好了,到这里就告一段落了~
我的django 通过lighttpd+fastcgi的方式跑起来咯~
测试一下你的服务器启动起来了吗??
相信大家都可以成功:)
有不清楚的可以给我留言,
以后再给大家一些好的文章:)www.htdocs.org
- 10步完成freebsd下 python+django+fastcgi+lighttpd+sqlite3 源码安装与配置.
- FreeBSD + Lighttpd + Django + FastCGI
- RedHat 上安装 lighttpd 并配置 fastcgi + django 的记录
- linux下lighttpd安装与配置
- linux下lighttpd安装与配置
- Lighttpd 配置fastcgi
- Lighttpd fastcgi相关配置
- lighttpd安装与配置
- lighttpd安装与配置
- [python web]linux下apache + django + mod_wsgi + sqlite3配置
- Python安装与Django配置
- 安装配置Linux+lighttpd+mysql+PHP(FastCGI)
- 安装配置Linux+lighttpd+mysql+PHP(FastCGI)
- Windows XP下安装Lighttpd、PHP、MYSQL(Fastcgi)!
- Lighttpd的安装与配置
- lighttpd的安装与配置
- 探索lighttpd用fastcgi模式访问django
- linux下fastcgi安装配置
- TCP聊天程序的使用说明
- FreeBSD + Lighttpd + Django + FastCGI
- EXcel分类显示法
- Oracle并行服务器(OPS)
- 简单说两句 Like 的优化
- 10步完成freebsd下 python+django+fastcgi+lighttpd+sqlite3 源码安装与配置.
- 提高js字符串连接的性能
- fast report 的使用说明
- Visual Studio 2008之新特性LINQ(三)之LINQ To Object查询
- iReport 笔记(一) 序
- 网站变黑(哀悼!!!!)
- 一位软件工程师的6年总结
- Unit Testing (using ReSharper 3.1)
- (转)form和column:extJS的布局