在Linux平台上安装和配置Redhat系列下安装rubyOnRails的生产环境(转)
上一篇 / 下一篇 2010-07-15 17:00:27 / 个人分类:转发
转发:http://docs.google.com/View?id=dc32cxpz_105hqdqknhq
简 单描述
这里介绍的内容是基于redhat系列(rhel或者centos)的。由于各个发行版的情况都有不一样的地方,如果使用的是其他发行版本请自行 google。另外我测试的环境是gcc4.x,这里使用的数据库是oracle,mysql的内容以后再加。 主要软件及用途如下:ruby1.8.7-p72-mbari(ruby解释器,用来解释ruby语言用的)fcgi(fast cgi运行模块)一般是使用多进程单线程的运行方式,部署在lighttpd+fcgi(非常高效,安装麻烦),或者nginx+mongrel/thin(高效,安装简 单)的架构上。
rails2.1.2(一个用ruby写的一站式快速开发框架)
oracle10g(数据库)
ruby- oci8(用来和oracle交互用的ruby库)
ruby-odbc(用来 和odbc交互用的ruby库)
RMagick(图形处理库)
memcached(流行的分布式缓存服务器)
lighttpd/nginx(web前端服务器)
mongrel/thin(用 来处理动态请求的http服务器)
安 装ruby
http://www.javaeye.com/wiki/rails_deployment/1296-deploy-rails-on-linuxhttp://www.javaeye.com/news/4592-resolve-memory-leaks-ruby-patch-release
下载ruby 1.8.7-p72.tar.gz和MBARIp72patches.tar.gz
tar zxvf ruby-1.8.7-p72.tar.gz备注:如果没有gcc,需要yum install gcc,如果是gcc3.x,需要去掉-fno-stack-protector
tar zxvf MBARIp72patches.tar.gz
解压打补丁命令:
MBARIp72patches/apply ruby-1.8.7-p72
编译ruby,如下:
cd ruby-1.8.7-p72
CFLAGS="-O2 -fno-stack-protector -mpreferred-stack-boundary=2" ./configure --prefix=/usr/local/ruby-1.8.7-p72
make && make install
编译之后,编辑/etc/profile,加入
export RUBY_HOME=/usr/local/ruby-1.8.7-p72PATH=$RUBY_HOME/bin:$PATH
执 行source /etc/profile,并使用ruby -v进行验证:
[root@localhost ext]# ruby -v
ruby 1.8.7 (2009-3-1 mbari 8B/0x8770 on patchlevel 72) [i686-linux]
下 载rubygems-1.3.1.tgz
tar zxvf rubygems-1.3.1.tgz并使用gem -v进行验证:
cd rubygems-1.3.1
ruby setup.rb
[root@localhost ext]# gem -v
1.3.1
安 装ruby-ext:zilb,readline或者openssl
cd ruby-1.8.7-p72/ext/zlib
ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
make && make install如果出错,可能需要进行yum install zlib-devel
cd ruby-1.8.7-p72/ext/readline
ruby extconf.rb
make && make install如果出错,可能需要进行yum install readline-devel
cd ruby-1.8.7-p72/ext/openssl
ruby extconf.rb
make && make install如果出错,可能需要进行yum install openssl-devel
安 装各式各样的gem
gem source -a http://gems.github.com备注:如果提示g++命令未找到,则yum install gcc-c++
gem install rails --version "2.1.2" --no-rdoc --no-ri
gem install mongrel_cluster --no-rdoc --no-ri
gem install memcache-client--version "1.7.3"--no-rdoc --no-ri
yum install libxml2*
gem install libxml-ruby --version "1.1.3" --no-rdoc --no-ri
gem install spreadsheet --version "0.6.3.1" --no-rdoc --no-ri
gem install uuidtools --version "2.0.0" --no-rdoc --no-ri
gem installcomposite_primary_keys--version"1.1.0"--no-rdoc --no-ri
gem install rack --no-rdoc --no-ri
gem install thin --no-rdoc --no-ri
gem install dbi --version "0.4.2" --no-rdoc --no-ri
gem install dbd-odbc --version "0.2.5" --no-rdoc --no-ri
安 装oracle即时客户端
rpm -ivh oracle-instantclient-basic-10.2.0.4-1.i386.rpm
rpm -ivh oracle-instantclient-devel-10.2.0.4-1.i386.rpm
可选:
#rpm -ivh oracle-instantclient-sqlplus-10.2.0.4-1.i386.rpm
#rpm -ivh oracle-instantclient-jdbc-10.2.0.4-1.i386.rpm
修改 /etc/profile,添加
export NLS_LANG="American_America.ZHS16GBK"
export LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.4/client/lib
PATH=$LD_LIBRARY_PATH:$PATH执行source /etc/profile
下载ruby-oci8-1.0.6.tar.gz
tar zxvf ruby-oci8-1.0.6.tar.gz
cd ruby-oci8-1.0.6
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
验证ruby- oci8安装情况
[root@localhost i686-linux]# irb如果出错的话(cannot restore segment prot after reloc: Permission denied), 需要执行/usr/sbin/setenforce 0来临时关闭selinux 也可以修改/etc/selinux/config把enforcing修改成disabled并重启
irb(main):001:0> require 'oci8'
=> true
安装 odbc
有时候我们需要用到sqlserver这样的东西,在linux上弄这个还是比较麻烦的。我们采取的方案是 unixODBC+freeTDS+ruby-odbc+dbi(dbd-odbc)的方式(我们并不打算使用orm)。首先需要安装的是 freeTDS(*unix下用来访问sybase和sqlserver的工具)和unixODBC(用来提供ODBC,在这里就是利用freeTDS的 驱动来提供一个DSN)yum install unixODBC-devel freetds-devel安装后可以测试一下
[root@localhost ~]# tsql -S 192.168.1.233 -U sa -P softsckj然后安装ruby- odbc,在http://www.ch-werner.de/rubyodbc/下载ruby-odbc-0.9997.tar.gz
locale is "zh_CN.UTF-8"
locale charset is "UTF-8"
1> use jw
2> select count(*) from ttuition
3> go
262846
1>
tar zxvf ruby-odbc-0.9997.tar.gz接下去进行配置:
cd ruby-odbc-0.9997
ruby extconf.rb
make && make install
修改/etc/freetds.conf
[MyServer2k]这里修改host,主要是为了可以引用到这个MyServer2K
host = 192.168.1.233
port = 1433
tds version = 8.0
修改/etc /odbcinst.ini(这是用来定义各种各样的Driver的地方)
[FreeTDS]修改/etc /odbc.ini(这里就是配置DSN的地方)
Description = ODBC for MS SqlServer
Driver = /usr/lib/libtdsodbc.so
Setup = /usr/lib/libtdsS.so
FileUsage = 1
[JW]注意到这里的MyServer2k引用的是 freetds.conf里边定义的。其实按道理这里直接使用ip就可以的,可惜的是,在freetds0.64里边设置ip的话,根本不起作用。
Description = jw
Driver = FreeTDS
Servername = MyServer2k
Database = jw
UID = sa
PWD = softsckj
最 后,简单写个脚本测试一下:
[root@localhost ~]# vi test.rb能够得出结果就表示配置成功了。
#!/bin/env ruby
require 'rubygems'
require 'dbi'
require 'odbc'
DBI.connect('dbi:ODBC:JW','sa','softsckj') do |dbh|
dbh.select_all('select top 10 * from ttuition') do |row|
p row.join(',')
end
end
安 装memcached
下载libevent-1.4.12-stable.tar.gz和memcached-1.4.0.tar.gztarzxvf libevent-1.4.12-stable.tar.gz
cd libevent-1.4.12-stable
./configure --prefix=/usr/local/libevent-1.4.12
make && make install
cp /usr/local/libevent-1.4.12/lib/libevent-1.4.so.2 /usr/lib/
tar zxvf memcached-1.4.0.tar.gz
cd memcached-1.4.0
./configure --with-libevent=/usr/local/libevent-1.4.12 --prefix=/usr/local/memcached-1.4.0
make && make install
运行并验证
[root@localhost bin]# /usr/local/memcached-1.4.0/bin/memcached -d -m 256 -p 11211 -u root
[root@localhost bin]# telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
stats
STAT pid 5075
STAT uptime 155
STAT time 1248845966
STAT version 1.4.0
安 装nginx
需要其他支持yum install pcre-developenssl-devel下载nginx-0.7.61.tar.gz
tarzxvf nginx-0.7.61.tar.gz
cd nginx-0.7.61
./configure --prefix=/usr/local/nginx-0.7.61 \
--user=nobody \
--group=nobody \
--without-poll_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-http_realip_module\
--with-http_ssl_module \
--with-http_flv_module \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log
make && make install
配 置/usr/local/nginx-0.7.61/conf/nginx.conf,示例:
user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
use epoll;
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
access_log off;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_types text/plain application/x-javascript. text/css text/html application/xml image/jpeg image/png image/gif;
upstream backend {
server 127.0.0.1:3000 weight=1;
server 127.0.0.1:3001 weight=1;
server 127.0.0.1:3002 weight=1;
server 127.0.0.1:3003 weight=1;
server 127.0.0.1:3004 weight=1;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#internal;
proxy_pass http://backend/;
#proxy_store on;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
index index.html index.php index.htm;
}
location /NginxStatus {
stub_status on;
access_log on;
auth_basic "NginxStatus";
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
root /var/www/gst/public;
index index.php;
access_log off;
expires 14d;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
测 试并运行和关闭
/usr/local/nginx-0.7.61/sbin/nginx -t
/usr/local/nginx-0.7.61/sbin/nginx -c /usr/local/nginx-0.7.61/conf/nginx.conf&
killall -HUP nginx
安 装RMagick
检测图片支持,如果检测不到的话,需要通过yum来安装rpm -qa | grep libpng如果你希望支持tiff格式,还 应该检查
rpm -qa | grep libpng-devel
rpm -qa | grep libjpeg
rpm -qa | grep gd-devel
rpm -qa | grep libtiff
下载ImageMagick-6.5.4-6.tar.bz2
tar jxvf ImageMagick-6.5.4-6.tar.bz2
cd ImageMagick-6.5.4-6
./configure --prefix=/usr/local/ImageMagick-6.5.4-6
make && make install
编辑/etc/profile里面 的PATH环境变量,加入:
export PATH=/usr/local/ImageMagick-6.5.4-6/bin:$PATH
编辑/etc /ld.so.conf,加入:/usr/local/ImageMagick-6.5.4-6/lib
执 行命令ldconfig将ImageMagick的库加入系统联接库
执行命令source /etc/profile让文件生效,最后验证convert logo: logo.gif看是否正确生成一个logo.gif的图片文件
下载RMagick-2.10.0.tar.bz2
tar jxvfRMagick-2.10.0.tar.bz2安装完成还是不能使用的话,可以下载rmagick-2.10.0.gem来安装
cdRMagick-2.10.0
ruby setup.rb
gem install rmagick-2.10.0.gem --no-rdoc --no-ri
安 装fcgi
由于ruby的fcgi支持库需要在编译的时候联接FCGI的系统库,因此我们需要先安装FCGI库,下载FCGI源代码发行 包:http://www.fastcgi.com/dist/tar xzvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure --prefix=/usr/local/fcgi-2.4.0
make && make install
然 后就可以安装ruby的fcgi支持库了,下载ruby-fcgi-0.8.7.tar.gz
tar xzvf ruby-fcgi-0.8.7.tar.gz
cd ruby-fcgi-0.8.7
ruby install.rb config -- --with-fcgi-dir=/usr/local/fcgi-2.4.0
ruby install.rb setup
ruby install.rb install
在public下面新建 dispatch.sh用来启动fcgi,如下:
#!/bin/sh这样就可以通过./dispatch.sh start来启动10个fcgi进程了,而lighttpd就是把请求交给这10个fcgi进程进行处理的。
DISPATCH_PATH=/var/www/gst/public/dispatch.fcgi
SOCKET_PATH=/tmp
PID_PATH=/tmp
RAILS_ENV=production
export RAILS_ENV
case "$1" in
start)
for num in 0 1 2 3 4 5 6 7 8 9
do
/usr/local/lighttpd-1.4.23/bin/spawn-fcgi -f $DISPATCH_PATH -s $SOCKET_PATH/rails$num.sock -P $PID_PATH/rails$num.pid -u lighttpd -g lighttpd
done
;;
stop)
killall -9 dispatch.fcgi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: dispatch.sh {start|stop|restart}"
;;
esac
exit 0
安 装lighttpd
需要其他支持yum install bzip2-devel下载lighttpd-1.4.23.tar.gz
yum install pcre-devel
yum install gamin-devel
tar xzvf lighttpd-1.4.23.tar.gz完 毕以后,会给出一个激活的模块和没有激活模块的清单,可以检查一下,是否自己需要的模块都已经激活,在enable的模块中一定要有 “mod_rewrite”这一项,否则重新检查pcre是否安装.最后编译:make && make install 最后把/usr/local/lighttpd-1.4.23/lib添加到/etc/ld.so.conf里边去并执行ldconfig
cdlighttpd-1.4.23
./configure --prefix=/usr/local/lighttpd-1.4.23 --with-fam
cp doc/rc.lighttpd.redhat /etc/init.d/lighttpd然后修改/etc/init.d/lighttpd,把
mkdir /etc/lighttpd
cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
LIGHTTPD_BIN=/usr/sbin/lighttpd
改为
LIGHTTPD_BIN=/usr/local/lighttpd-1.4.23/sbin/lighttpd
配置/etc/lighttpd/lighttpd.conf,示例:
# lighttpd configuration file#
# use it as a base for lighttpd 1.0.0 and above
#
# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $
############ Options you really have to take care of ####################
## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules = (
"mod_rewrite",
# "mod_redirect",
# "mod_alias",
"mod_access",
# "mod_cml",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
"mod_fastcgi",
# "mod_proxy",
"mod_simple_vhost",
# "mod_evhost",
# "mod_userdir",
"mod_cgi",
"mod_compress",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
# "mod_secdownload",
# "mod_rrdtool",
#"mod_accesslog"
)
## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root = "/var/www/gst/public"
## where to send error-messages to
server.errorlog = "/var/log/lighttpd/error.log"
# files to check for if .../ is requested
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm" )
## set the event-handler (read the performance section in the manual)
# server.event-handler = "freebsd-kqueue" # needed on OS X
# mimetype mapping
mimetype.assign = (
".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" => "application/ogg",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jar" => "application/x-java-archive",
".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",
".cpp" => "text/plain",
".log" => "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",
# default mime type
"" => "application/octet-stream",
)
# Use the "Content-Type" extended attribute to obtain mime type if possible
#mimetype.use-xattr = "enable"
## send a different Server: header
## be nice and keep it at lighttpd
# server.tag = "lighttpd"
#### accesslog module
#accesslog.filename = "/var/log/lighttpd/access.log"
## deny access the file-extensions
#
# ~ is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be part
# of the document-root
url.access-deny = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
server.range-requests = "disable"
}
##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
######### Options that are good to be but not neccesary to be changed #######
## bind to port (default: 80)
server.port = 80
## bind to localhost (default: all interfaces)
server.bind = "0.0.0.0"
## error-handler for status 404
#server.error-handler-404 = "/error-handler.html"
#server.error-handler-404 = "/error-handler.php"
## to help the rc.scripts
server.pid-file = "/var/log/lighttpd/lighttpd.pid"
server.stat-cache-engine = "fam"
server.event-handler = "linux-sysepoll"
server.network-backend = "linux-sendfile"
server.max-request-size = 10240
server.max-fds = 2048
###### virtual hosts
##
## If you want name-based virtual hosting add the next three settings and load
## mod_simple_vhost
##
## document-root =
## virtual-server-root + virtual-server-default-host + virtual-server-docroot
## or
## virtual-server-root + http-host + virtual-server-docroot
##
#simple-vhost.server-root = "/srv/www/vhosts/"
#simple-vhost.default-host = "www.example.org"
#simple-vhost.document-root = "/htdocs/"
##
## Format: <errorfile-prefix><status-code>.html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix = "/usr/share/lighttpd/errors/status-"
#server.errorfile-prefix = "/srv/www/errors/status-"
## virtual directory listings
#dir-listing.activate = "enable"
## select encoding for directory listings
#dir-listing.encoding = "utf-8"
## enable debugging
#debug.log-request-header = "enable"
#debug.log-response-header = "enable"
#debug.log-request-handling = "enable"
#debug.log-file-not-found = "enable"
### only root can use these options
#
# chroot() to directory (default: no chroot() )
#server.chroot = "/"
## change uid to <uid> (default: don't care)
server.username = "lighttpd"
## change uid to <uid> (default: don't care)
server.groupname = "lighttpd"
#### compress module
compress.cache-dir = "/tmp/"
compress.filetype = ("text/plain", "text/html","text/javascript","text/css")
#### proxy module
## read proxy.txt for more info
#proxy.server = ( ".php" =>
# ( "localhost" =>
# (
# "host" => "192.168.0.101",
# "port" => 80
# )
# )
# )
#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
#fastcgi.server = ( ".php" =>
# ( "localhost" =>
# (
# "socket" => "/var/run/lighttpd/php-fastcgi.socket",
# "bin-path" => "/usr/local/bin/php-cgi"
# )
# )
# )
#### CGI module
#cgi.assign = ( ".pl" => "/usr/bin/perl",
# ".cgi" => "/usr/bin/perl" )
#
#### SSL engine
#ssl.engine = "enable"
#ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
#### status module
#status.status-url = "/server-status"
#status.config-url = "/server-config"
#### auth module
## read authentication.txt for more info
#auth.backend = "plain"
#auth.backend.plain.userfile = "lighttpd.user"
#auth.backend.plain.groupfile = "lighttpd.group"
#auth.backend.ldap.hostname = "localhost"
#auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
#auth.backend.ldap.filter = "(uid=$)"
#auth.require = ( "/server-status" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "user=jan"
# ),
# "/server-config" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "valid-user"
# )
# )
#### url handling modules (rewrite, redirect, access)
#url.rewrite = ( "^/$" => "/server-status" )
#url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
#### both rewrite/redirect support back reference to regex conditional using %n
#$HTTP["host"] =~ "^www\.(.*)" {
# url.redirect = ( "^/(.*)" => "http://%1/$1" )
#}
$HTTP["host"] == "192.168.1.210" {
server.document-root = "/var/www/gst/public"
server.error-handler-404 = "/dispatch.fcgi"
fastcgi.server = (".fcgi" =>
(
("socket"=>"/tmp/rails0.sock"),
("socket"=>"/tmp/rails1.sock"),
("socket"=>"/tmp/rails2.sock"),
("socket"=>"/tmp/rails3.sock"),
("socket"=>"/tmp/rails4.sock"),
("socket"=>"/tmp/rails5.sock"),
("socket"=>"/tmp/rails6.sock"),
("socket"=>"/tmp/rails7.sock"),
("socket"=>"/tmp/rails8.sock"),
("socket"=>"/tmp/rails9.sock")
)
)
}
#
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
#evhost.path-pattern = "/srv/www/vhosts/%3/htdocs/"
#### expire module
#expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
#### ssi
#ssi.extension = ( ".shtml" )
#### rrdtool
#rrdtool.binary = "/usr/bin/rrdtool"
#rrdtool.db-name = "/var/lib/lighttpd/lighttpd.rrd"
#### setenv
#setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
#setenv.add-response-header = ( "X-Secret-Message" => "42" )
## for mod_trigger_b4_dl
# trigger-before-download.gdbm-filename = "/var/lib/lighttpd/trigger.db"
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
# trigger-before-download.trigger-url = "^/trigger/"
# trigger-before-download.download-url = "^/download/"
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
# trigger-before-download.trigger-timeout = 10
## for mod_cml
## don't forget to add index.cml to server.indexfiles
# cml.extension = ".cml"
# cml.memcache-hosts = ( "127.0.0.1:11211" )
#### variable usage:
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
#bar = 1
#var.mystring = "foo"
## integer add
#bar += 1
## string concat, with integer cast as string, result: "www.foo1.com"
#server.name = "www." + mystring + var.bar + ".com"
## array merge
#index-file.names = (foo + ".php") + index-file.names
#index-file.names += (foo + ".php")
#### include
#include /etc/lighttpd/lighttpd-inc.conf
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
#include "lighttpd-inc.conf"
#### include_shell
#include_shell "echo var.a=1"
## the above is same as:
#var.a=1
相关阅读:
- 系统测试过程中的僵尸进程 (lilynage, 2010-7-13)
- Linux系统管理员:不要害怕升级内核 (51testing, 2010-7-13)
- Linux命令之apt命令详解 (51testing, 2010-7-14)
- 关于Linux系统的平均负载最全面介绍 (Kingson, 2010-7-15)
- JDK1.6在LINUX下的安装配置(转发) (fengsuiyuanzou, 2010-7-15)
TAG: Linux linux on rails Ruby ruby
标题搜索
日历
|
|||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
1 | 2 | ||||||||
3 | 4 | 5 | 6 | 7 | 8 | 9 | |||
10 | 11 | 12 | 13 | 14 | 15 | 16 | |||
17 | 18 | 19 | 20 | 21 | 22 | 23 | |||
24 | 25 | 26 | 27 | 28 | 29 | 30 | |||
31 |
我的存档
数据统计
- 访问量: 28969
- 日志数: 95
- 建立时间: 2008-11-05
- 更新时间: 2013-09-17