今天尝试了一下部署一个rails 应用到lighttpd + fastcgi的环境, 把步骤记了一下,
希望对其他人也有用.
Lighttpd 部分的配置有点粗糙,主要是图省事所以很多地方的路径都写死了.
我的操作系统是Redhat 4
首先 在sudoers中加入一个可以使用sudo命令的用户.
su
vi /etc/sudoers
找到这行
# User privilege specification
root ALL=(ALL) ALL
然后加入你的用户名
# User privilege specification
root ALL=(ALL) ALL
yourUserName ALL=(ALL) ALL
保存, 退出.
su yourUserName
1. 安装Ruby On Rails
下载ruby源码 http://rubyforge.org/frs/download.php/7858/ruby-1.8.4.tar.gz
复制到/home/yourUserName/rubys
cd /home/yourUserName/rubys
tar zxvf ruby-1.8.4.tar.gz
cd ruby-1.8.4
sudo ./configure
sudo make
sudo make install
安装gems
下载gems
cd rubygems-0.8.11
sudo ruby setup.rb
如果成功能看到 Successfully build Ruby Gems.
安装rails
export http_proxy=http://servername:port
sudo gem install rails --include-dependencies
2. 安装 lighttpd 及fastcgi
tar zvxf lighttpd-1.4.13.tar.gz
cd lighttpd-1.4.13
sudo ./configure
sudo make
sudo make install
接下去安装fastcgi lib
wget http://www.fastcgi.com/dist/fcgi.tar.gz
tar zxvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
sudo ./configure
sudo make
sudo make install
接下去安装 Ruby FastCGI Bindings
wget http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gz
tar zxvf ruby-fcgi-0.8.6.tar.gz
cd ruby-fcgi-0.8.6
sudo ruby install.rb config
sudo ruby install.rb setup
sudo ruby install.rb install
3. 配置 Lighttpd
创建几个目录
/home/yourHomeDir/web/etc
/home/yourHomeDir/web/var
创建Lighttpd 配置文件
cd /home/yourHomeDir
vi lighttpd.conf
输入以下内容
server.port = 80
server.pid-file = "/home/yourHomeDir/web/etc/lighttpd.pid"
server.modules = ( "mod_redirect", "mod_access", "mod_fastcgi", "mod_accesslog", "mod_simple_vhost" )
server.document-root = "/home/yourHomeDir/web/"
server.indexfiles = ( "index.php", "index.html" )
accesslog.filename = "/home/yourHomeDir/web/var/access_log"
server.errorlog = "/home/yourHomeDir/web/var/error_log"
# simple virtual hosting
simple-vhost.server-root = "/home/yourHomeDir/web"
simple-vhost.default-host = "test"
simple-vhost.document-root = "public"
# Start of test vhost
$HTTP["host"] == "test" {
server.document-root = "/home/yourHomeDir/web/rforum/public/"
accesslog.filename = "/home/yourHomeDir/web/rforum/access.log"
server.indexfiles = ( "dispatch.fcgi", "index.html" )
server.error-handler-404 = "/dispatch.fcgi"
# rails stuff
#### fastcgi module
fastcgi.server = (
".fcgi" => (
"test" => (
"socket" => "/tmp/test1.socket",
"bin-path" => "/home/yourHomeDir/web/rforum/public/dispatch.fcgi",
"min-procs" => 1,
"max_procs" => 2
)
)
)
}
# End of test vhost
# mimetype mapping
mimetype.assign = (
".rpm" => "application/x-rpm",
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "audio/x-wav",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar"
)
创建一个启动Lighttpd 脚本 vi lighttpd.sh
内容如下
#!/bin/sh
# This is for Starting/Stopping/Restarting Lighttpd. You won't need
# to edit anything.
HOME=/home/yourHomeDir
LIGHTTPD_CONF=$HOME/etc/lighttpd/lighttpd.conf
PIDFILE=$HOME/var/run/lighttpd.pid
export SHELL=/bin/sh
case "$1" in
start)
# Starts the lighttpd deamon
echo "Starting Lighttpd"
PATH=$PATH:/usr/local/bin /usr/local/sbin/lighttpd -f $LIGHTTPD_CONF
;;
stop)
# stops the daemon bt cat'ing the pidfile
echo "Stopping Lighttpd"
kill `/bin/cat $PIDFILE`
;;
restart)
## Stop the service regardless of whether it was
## running or not, start it again.
echo "Restarting Lighttpd"
$0 stop
$0 start
;;
reload)
# reloads the config file by sending HUP
echo "Reloading config"
kill -HUP `/bin/cat $PIDFILE`
;;
*)
echo "Usage: lighttpdctrl (start|stop|restart|reload)"
exit 1
;;
esac
上面脚本里的yourHomeDir改为你实际的用户目录.
4. 将rforum解压缩到/home/yourHomeDir/web/
接下去根据rforum的readme配置rforum
ok, 运行sudo ./lighttpd.sh start来启动 lighttpd.
分享到:
- 2006-10-27 17:09
- 浏览 3499
- 评论(0)
- 论坛回复 / 浏览 (0 / 6098)
- 查看更多
相关推荐
redhat5.4+SSH+Ftp+Apache+Mysql+PHP搭建 redhat5.4+SSH+Ftp+Apache+Mysql+PHP搭建 redhat5.4+SSH+Ftp+Apache+Mysql+PHP搭建 redhat5.4+SSH+Ftp+Apache+Mysql+PHP搭建
linux(redhat+ubuntu)安装教程+图解
RedHat5.5+IBM DS4800+Oracle10g RAC+LVM 安装
GaussDB 是华为推出的一款企业级 AI-Native 分布式数据库,取名 Gauss 是在致敬数学家高斯。GaussDB 也是全球首款人工智能原生(AI-Native)数据库。华为高斯数据库GaussDB100 (redhatx64位),华为Data_Studio可视...
redhat7.0 Apache2.4.18 MySql5.7.10 PHP5.6.9 实操过程
RAC, 全称 real applic ation c lusters,译为 ... 在 Orac le RAC 环境下, Orac le 集成提供了集群软件和存储 管理软件,为用户降低了应用 成本。当应用规模需要扩充时,用户可以按需 扩展系统,以保证系统的性能。
RedHat linux7-虚拟化+集群安装精简手册.doc
Redhat Linux 6 操作系统LVS_DR+Keepalived模式下配置的详细文档,按照文档的部署和配置可实现 LVS_DR+Keepalived的负载均衡。
在IT领域,尤其是在数据库管理与高可用性方案中,Oracle DataGuard是一项被广泛采用的技术,它为数据库提供了灾难恢复和数据保护的能力。本文将详细解析如何在Redhat系统上逐步设置Oracle DataGuard,以创建一个物理...
以上就是REDHAT环境下配置NFS和SAMBA服务的详细步骤,通过这两种服务,你可以构建一个高效、安全的文件共享环境,促进跨平台的协作。记得在配置过程中,始终关注安全性和稳定性,避免不必要的风险。
Redhat6.0下安装单节点Oracle11gR2、Jdk以及Tomcat文档。
Step by Step install Redhat Enterprise Linux(RHEL 7.1) v7.1
redhat linux 部署Kafka集群
RedHat Ceph分布式存储安装部署手册 本文档旨在指导用户安装和部署Red Hat Ceph Storage 1.3,旨在帮助用户快速了解Red Hat Ceph Storage的安装和部署过程。Red Hat Ceph Storage是一款基于分布式对象存储和文件...
详细讲解了如何在VMware下安装Redhat5操作系统。并配置固定IP地址和主机名。
### Red Hat Enterprise Linux 5 (RHEL5) 安装 Oracle 10g、JDK 和 Tomcat #### 概述 ...通过以上步骤,即使是对这些技术不熟悉的用户也能够成功地完成安装,并为进一步的应用开发和部署打下坚实的基础。
linux下tomcat+JDK+redhat配置文档+安装软件linux下tomcat+JDK+redhat配置文档+安装软件linux下tomcat+JDK+redhat配置文档+安装软件linux下tomcat+JDK+redhat配置文档+安装软件linux下tomcat+JDK+redhat配置文档+...
redhat6.9安裝oracle11g所需完整依赖rpm包。可以在终端输入:rpm -q binutils compat-libcap1 compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-...
在本文中,我们将探讨如何在Red Hat Enterprise Linux(RHEL)6.4操作系统上部署Zabbix监控系统。Zabbix是一个高度集成的开源监控解决方案,用于监控网络、服务器、虚拟机和云服务的状态和性能。部署过程涉及到关闭...