generate certificate using mkcert then

add the below code in script/rails file

require 'rails/commands/server'
require 'rack'
require 'webrick'
require 'webrick/https'

if ENV['SSL'] == "true"
module Rails
class Server < ::Rack::Server def default_options super.merge({ :Port => 80,
:environment => (ENV['RAILS_ENV'] || "development").dup,
:daemonize => false,
:debugger => false,
:pid => File.expand_path("tmp/pids/server.pid"),
:config => File.expand_path("config.ru"),
:SSLEnable => true,
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
:SSLPrivateKey => OpenSSL::PKey::RSA.new(
File.open("/Users/xploralab/work/xploralab-key.pem").read),
:SSLCertificate => OpenSSL::X509::Certificate.new(
File.open("/Users/xploralab/work/xploralab.crt").read),
:SSLCertName => [["CN", WEBrick::Utils::getservername]],
})
end
end
end
end

then run your site

rvmsudo rails s -b site.com -p 80