RedHat 上安装 lighttpd 并配置 fastcgi + django 的记录
来源:互联网 发布:淘宝企业店铺 个体 编辑:程序博客网 时间:2024/05/16 02:22
================== 安装 flup =================================
cd /downloads
mkdir flup
cd flup
svn co http://svn.saddi.com/flup/trunk
获取了 revision 2341.
cd trunk
python setup.py install
添加 manage.py 的执行权限
chmod +x /var/www/html/myproject/manage.py
启动 fastcgi
python /var/www/html/myproject/manage.py runfcgi method=prefork socket=/tmp/myproject.sock pidfile=/tmp/django.pid
================== 安装 lighttpd ==============================
首先要安装一些必要的库(否则后面会出错):
yum install glib2-devel
yum install pcre-devel
yum install zlib-devel
安装 lighttpd 1.4.13 版本
=============================
(开始尝试过 1.5.0,编译是没问题,但因为是一个 pre-release 版本,文档还没完全跟上。结果配置 fast-cgi / django 的时候有个选项不会配置,只好放弃。原因是新的配置语法用 mod_proxy_core 取代了 mod_fastcgi 等 3 个模块)
cd /downloads
wget http://www.lighttpd.net/assets/2007/1/29/lighttpd-1.4.13.tar.gz
tar zxvf lighttpd-1.4.13.tar.gz
cd lighttpd-1.4.13
./configure
make
make install
cd doc
cp lighttpd.conf /etc
vi /etc/lighttpd.conf
配置文件内容如下:
1 server.modules = ( 2 "mod_rewrite", 3 "mod_redirect", 4 "mod_alias", 5 "mod_access", 6 "mod_fastcgi", 7 "mod_accesslog" ) 8 9 server.document-root = "/var/www/html/" 10 server.errorlog = "/var/www/logs/lighttpd.error.log" 11 accesslog.filename = "/var/www/logs/access.log" 12 13 index-file.names = ( "index.php", "index.html", 14 "index.htm", "default.htm" ) 15 16 mimetype.assign = ( 17 ".pdf" => "application/pdf", 18 ".sig" => "application/pgp-signature", 19 ".spl" => "application/futuresplash", 20 ".class" => "application/octet-stream", 21 ".ps" => "application/postscript", 22 ".torrent" => "application/x-bittorrent", 23 ".dvi" => "application/x-dvi", 24 ".gz" => "application/x-gzip", 25 ".pac" => "application/x-ns-proxy-autoconfig", 26 ".swf" => "application/x-shockwave-flash", 27 ".tar.gz" => "application/x-tgz", 28 ".tgz" => "application/x-tgz", 29 ".tar" => "application/x-tar", 30 ".zip" => "application/zip", 31 ".mp3" => "audio/mpeg", 32 ".m3u" => "audio/x-mpegurl", 33 ".wma" => "audio/x-ms-wma", 34 ".wax" => "audio/x-ms-wax", 35 ".ogg" => "application/ogg", 36 ".wav" => "audio/x-wav", 37 ".gif" => "image/gif", 38 ".jpg" => "image/jpeg", 39 ".jpeg" => "image/jpeg", 40 ".png" => "image/png", 41 ".xbm" => "image/x-xbitmap", 42 ".xpm" => "image/x-xpixmap", 43 ".xwd" => "image/x-xwindowdump", 44 ".css" => "text/css", 45 ".html" => "text/html", 46 ".htm" => "text/html", 47 ".js" => "text/javascript", 48 ".asc" => "text/plain", 49 ".c" => "text/plain", 50 ".cpp" => "text/plain", 51 ".log" => "text/plain", 52 ".conf" => "text/plain", 53 ".text" => "text/plain", 54 ".txt" => "text/plain", 55 ".dtd" => "text/xml", 56 ".xml" => "text/xml", 57 ".mpeg" => "video/mpeg", 58 ".mpg" => "video/mpeg", 59 ".mov" => "video/quicktime", 60 ".qt" => "video/quicktime", 61 ".avi" => "video/x-msvideo", 62 ".asf" => "video/x-ms-asf", 63 ".asx" => "video/x-ms-asf", 64 ".wmv" => "video/x-ms-wmv", 65 ".bz2" => "application/x-bzip", 66 ".tbz" => "application/x-bzip-compressed-tar", 67 ".tar.bz2" => "application/x-bzip-compressed-tar" 68 ) 69 70 url.access-deny = ( "~", ".inc" ) 71 static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) 72 73 $HTTP["host"] == "www.mydomain.com" { 74 server.port = 80 75 url.redirect = ( 76 "^(.*)" => "http://mydomain.com:80$1" 77 ) 78 } 79 80 $HTTP["host"] == "mydomain.com" { 81 server.name = "mydomain.com" 82 server.port = 80 83 server.document-root = "/var/www/html/myproject" 84 85 fastcgi.server = ( 86 "/myproject.fcgi" => ( 87 "main" => ( 88 "socket" => "/tmp/myproject.sock", 89 "check-local" => "disable" 90 ) 91 ) 92 ) 93 alias.url = ( 94 "/site_media/" => "/var/www/html/myproject/media/", 95 ) 96 url.rewrite-once = ( 97 "(/site_media.*)$" => "$1", 98 "^(/.*)$" => "/myproject.fcgi$1" 99 )100 }101 102
配置完毕后启动 lighttpd:
lighttpd -f /etc/lighttpd.conf
(如果不想运行为后台进程,用如下命令:
lighttpd -D -f /etc/lighttpd.conf
便于调试)
要停止 lighttpd 进程,用命令
ps -ef|grep lighttpd
查看到 pid
然后
kill -9 [pid]
即可。
- RedHat 上安装 lighttpd 并配置 fastcgi + django 的记录
- RedHat 上安装多个 mysql 实例并配置 django 连接的操作记录
- FreeBSD + Lighttpd + Django + FastCGI
- 10步完成freebsd下 python+django+fastcgi+lighttpd+sqlite3 源码安装与配置.
- Lighttpd 配置fastcgi
- Lighttpd fastcgi相关配置
- Linux 上完全手动编译安装 Lighttpd + PHP4(FastCGI) + eAccelerator
- Lighttpd 的安装配置
- Lighttpd 的安装配置
- 说说lighttpd的fastcgi
- 安装配置Linux+lighttpd+mysql+PHP(FastCGI)
- 安装配置Linux+lighttpd+mysql+PHP(FastCGI)
- 在redhat上安装ftp服务器并创建用户的操作步骤记录
- 探索lighttpd用fastcgi模式访问django
- Openwrt上Php+Mysql+Lighttpd的安装配置
- globus 4.0.8 在redhat上的安装配置全程记录
- 在Linux下Fastcgi的Apache2上的安装配置
- Lighttpd 的安装配置zz
- 修改 Django 的邮件发送模块
- 用状态机模式消除复杂的 if else 逻辑
- FrameSet 不能支持透明
- 我的 SciTEGlobal.properties 配置文件
- [转载] 让SciTE能够和IDE一样进行成员提示
- RedHat 上安装 lighttpd 并配置 fastcgi + django 的记录
- RedHat 上安装多个 mysql 实例并配置 django 连接的操作记录
- 在 Django 的 View 中利用 function decorator 可实现一定程度的代码重用
- Django 代码片断收集(持续更新)
- 今天思路有点乱,随便记一点关于 xml-rpc 的
- 今天在 Linux 上顺利编译 PIL 1.1.6 成功
- 用 PIL 写了个简单的缩略图生成程序
- PIL 学习笔记(3)
- Partition Outer-Joins(Example)