Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 在Sinatra上本地测试HTTPS_Ruby_Sinatra_Thin - Fatal编程技术网

Ruby 在Sinatra上本地测试HTTPS

Ruby 在Sinatra上本地测试HTTPS,ruby,sinatra,thin,Ruby,Sinatra,Thin,当我通过HTTPS访问我的页面时,我需要测试页面上的一些元素的行为-我想知道如何使用HTTPS在本地测试这个sinatra应用程序。如果我的问题没有意义,我很抱歉,但我想通过HTTPS通过我的web浏览器连接到localhost。简短回答:您可以为本地开发创建自签名证书。Heroku有一篇关于这个问题的简短文章 一旦您创建了证书和密钥,使用Thin就非常简单: SSL options: --ssl Enables SSL --ssl-

当我通过HTTPS访问我的页面时,我需要测试页面上的一些元素的行为-我想知道如何使用HTTPS在本地测试这个sinatra应用程序。如果我的问题没有意义,我很抱歉,但我想通过HTTPS通过我的web浏览器连接到localhost。

简短回答:您可以为本地开发创建自签名证书。Heroku有一篇关于这个问题的简短文章

一旦您创建了证书和密钥,使用Thin就非常简单:

SSL options:
    --ssl                        Enables SSL
    --ssl-key-file PATH          Path to private key
    --ssl-cert-file PATH         Path to certificate
    --ssl-verify                 Enables SSL certificate verification

您正在通过哪个web服务器运行Sinatra?@Larsenal thin。所以这也许是一个简单的问题?
bundle exec thin start-p 3001-R config.ru--ssl--ssl密钥文件~/.ssl/server.key--ssl证书文件~/.ssl/server.crt
对我很有效