Skip to content

Instantly share code, notes, and snippets.

@x2q
Created December 1, 2012 09:55
Show Gist options
  • Save x2q/4181366 to your computer and use it in GitHub Desktop.
Save x2q/4181366 to your computer and use it in GitHub Desktop.
simple and fast Ruby/Rack/Thin setup for a serving static html site with ssl support
require 'rack/contrib/try_static'
require 'rack/ssl-enforcer'
if ENV['RACK_ENV'] == 'production'
use Rack::SslEnforcer
end
use Rack::TryStatic,
:root => "public",
:urls => %w[/],
:try => ['.html', 'index.html', '/index.html']
run lambda { [404, {'Content-Type' => 'text/html'}, ['Not Found']]}
source :rubygems
gem 'rack-contrib'
gem 'thin'
gem 'rack-ssl-enforcer'
web: bundle exec thin start -p $PORT -e $RACK_ENV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment