ruby网页服务器,thin: thin 是一个轻巧快速的 Ruby web 服务器

Thin

A small and fast Ruby web server

Installation

gem install thin

Or add thin to your Gemfile:

gem 'thin'

Usage

A +thin+ script offers an easy way to start your Rack application:

thin start

Browse the example directory for sample applications.

Usage with Rails Action Cable

To use Thin with Action Cable, add the following to your Gemfile:

gem 'faye-websocket'

gem 'thin' # If not already done

Create a config/initializers/thin_action_cable.rb:

Rails.application.config.action_cable.use_faye = true

Faye::WebSocket.load_adapter 'thin'

CLI

Use a rackup (config.ru) file and bind to localhost port 8080:

thin -R config.ru -a 127.0.0.1 -p 8080 start

Store the server process ID, log to a file and daemonize:

thin -p 9292 -P tmp/pids/thin.pid -l logs/thin.log -d start

Thin is quite flexible in that many options can be specified at the command line (see thin -h for more).

Configuration files

You can create a configuration file using thin config -C config/thin.yml.

You can then use it with all commands, such as: thin start -C config/thin.yml.

Here is an example config file:

---

user: www-data

group: www-data

pid: tmp/pids/thin.pid

timeout: 30

wait: 30

log: log/thin.log

max_conns: 1024

require: []

environment: production

max_persistent_conns: 512

servers: 1

threaded: true

no-epoll: true

daemonize: true

socket: tmp/sockets/thin.sock

chdir: /path/to/your/apps/root

tag: a-name-to-show-up-in-ps aux

License

Credits

The parser was originally from Mongrel http://mongrel.rubyforge.org by Zed Shaw.

Mongrel is copyright 2007 Zed A. Shaw and contributors. It is licensed under

the Ruby license and the GPL2.

Thin is copyright Marc-Andre Cournoyer macournoyer@gmail.com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值