Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 23 lines (18 sloc) 0.577 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/env ruby

config = ARGV.shift || ('config.ru' if File.exists?('config.ru'))
port = ARGV.shift || 0
root = ARGV.shift || Dir.pwd

unless config && File.exists?(config) && File.directory?(root)
  abort "Usage: nginx_thin config.ru [port] [root_path]"
end

require 'nginx_thin'

app, opts = Rack::Builder.parse_file(config)

server = NginxThin.new app, port, root
server.start
puts server.url
puts "kill -INT #{$$} or CTRL+C to quit"
puts "kill -HUP #{$$} to restart"
trap(:INT) { server.stop }
trap(:HUP) { server.stop; server.start }
system "open #{server.url}"
sleep
Something went wrong with that request. Please try again.