Created
May 18, 2010 21:06
-
-
Save karmatr0n/405549 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Example of config.ru for Application based on Sinatra + WeBrick + SSL | |
# | |
require File.dirname(__FILE__) + '/environment' | |
require File.dirname(__FILE__) + '/your_sinatra_app' | |
require 'webrick' | |
require 'webrick/https' | |
certificate = "/your/path/certs/myssl.crt" | |
private_key = "/your/path/certs/myssl.key" | |
ssl_options = { | |
:Port => 443, | |
:SSLEnable => true, | |
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE, | |
:SSLCertificate => OpenSSL::X509::Certificate.new(File.open(certificate).read), | |
:SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open(private_key).read), | |
:SSLCertName => [ [ "CN", WEBrick::Utils::getservername ] ] | |
} | |
server = WEBrick::HTTPServer.new(options) | |
server.mount "/", Rack::Handler::WEBrick, YourSinatraApp.new | |
Signal.trap(:INT) { server.shutdown } | |
server.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment