Created
June 19, 2013 15:45
-
-
Save ruslanosipov/5815349 to your computer and use it in GitHub Desktop.
Rails server over SSL, do "bundle exec ruby scripts/rails_secure.rb server"
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
#!/usr/bin/env ruby | |
require 'rubygems' # if ruby 1.8.7 | |
require 'rails/commands/server' | |
require 'rack' | |
require 'webrick' | |
require 'webrick/https' | |
module Rails | |
class Server < ::Rack::Server | |
def default_options | |
super.merge({ | |
:Port => 3001, | |
:environment => (ENV['RAILS_ENV'] || "development").dup, | |
:daemonize => false, | |
:debugger => false, | |
:config => File.expand_path("config.ru"), | |
:SSLEnable => true, | |
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE, | |
# Optional: load a certificate "custom.cert.key" | |
# :SSLPrivateKey => OpenSSL::PKey::RSA.new( | |
# File.open("config/cert/ss/custom.cert.key").read), | |
# :SSLCertificate => OpenSSL::X509::Certificate.new( | |
# File.open("config/cert/ss/custom.cert.crt").read), | |
:SSLCertName => [["CN", WEBrick::Utils::getservername]], | |
}) | |
end | |
end | |
end | |
APP_PATH = File.expand_path('../../config/application', __FILE__) | |
require File.expand_path('../../config/boot', __FILE__) | |
require 'rails/commands' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment