Skip to content

Instantly share code, notes, and snippets.

@kost
Created August 6, 2013 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kost/6165980 to your computer and use it in GitHub Desktop.
Save kost/6165980 to your computer and use it in GitHub Desktop.
Basic HTTPS server using webrick
#!/usr/bin/env ruby
require 'openssl'
require 'webrick'
require 'webrick/https'
include WEBrick
port = 8443
server = HTTPServer.new(:Port=>port,:DocumentRoot=>Dir::pwd,
:SSLEnable=>true,
:SSLCertName => [ [ "CN",WEBrick::Utils::getservername ] ]
)
trap("INT"){ server.shutdown }
server.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment