Ruby Thin服务器

[size=medium][b]1. 获得thin[/b][/size]
gem install thin

[size=medium][b]2. 安装thin[/b][/size]
thin install
会添加一个/etc/thin的目录,还会告诉你如何把Thin加为自动启动
[quote]To configure thin to start at system boot:
on RedHat like systems:
sudo /sbin/chkconfig --level 345 thin on
on Debian-like systems (Ubuntu):
sudo /usr/sbin/update-rc.d -f thin defaults
on Gentoo:
sudo rc-update add thin default
[/quote]
[size=medium][b]3. 创建应用配置文件[/b][/size]
sudo thin config -C /etc/thin/<config-name>.yml -c <rails-app-root-path> --servers <number-of-threads> -e <environment>  


下面是两个例子:
thin config -C /etc/thin/redmine.yml -c /var/www/redmine --servers 5 -e production  
thin config -C /etc/thin/myapp.yml -c /var/rails/myapp --servers 5 --socket /tmp/thin.myapp.sock -e production

当执行第一条config命令,可能得到/etc/thin/redmine.yml内容如下:
---
address: localhost
pid: tmp/pids/thin.pid
wait: 30
port: 3000
timeout: 30
log: log/thin.log
max_conns: 1024
require: []

environment: production
max_persistent_conns: 512
servers: 5
daemonize: true
chdir: /var/www/redmine

注:我这里address为0.0.0.0,被手动修改成ocalhost

[size=medium][b]4。启动应用[/b][/size]
sevice thin start
将会启动3000~3004共5个端口。
如果你有Nginx就可以设置一个代理转发了
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值