简体   繁体   English

无法使用SSL在PUMA上运行Rails应用程序

[英]Unable to run rails application on puma using ssl

I'm trying to run my rails app on puma in development environment on windows box. 我试图在Windows Box上的开发环境中的PUMA上运行我的Rails应用程序。 Without ssl the application works fine.. 没有ssl的应用程序可以正常工作。

But when I try to configure ssl for puma, nothing happens. 但是,当我尝试为puma配置ssl时,什么也没有发生。 No error is generated in the log and the web page ( https://localhost:3000/ ) says Secure Connection Failed. 日志中没有错误生成,并且网页( https:// localhost:3000 / )表示安全连接失败。 Below is the output from command line that shows the server started but nothing happened after that.. 下面是命令行的输出,显示了服务器已启动,但此后没有任何反应。

E:\ap01\dev\rmmi>foreman start -p 3000
17:19:31 web.1  | started with pid 3016
17:19:34 web.1  | *** SIGUSR2 not implemented, signal based restart unavailable!
17:19:34 web.1  | *** SIGUSR1 not implemented, signal based restart  unavailable!
17:19:34 web.1  | *** SIGHUP not implemented, signal based logs reopening unavailable!
17:19:34 web.1  | Puma starting in single mode...
17:19:34 web.1  | * Version 2.11.2 (ruby 2.0.0-p353), codename: Intrepid Squirrel
17:19:34 web.1  | * Min threads: 5, max threads: 5
17:19:34 web.1  | * Environment: development
17:19:36 web.1  | * Listening on tcp://0.0.0.0:3000
17:19:36 web.1  | * Listening on ssl://127.0.0.1:3000?cert=E:/ap01/OpenSSL-Win32/bin/server.crt&key=E:/ap01/OpenSSL-Win32/bin/server.key
17:19:36 web.1  | Use Ctrl-C to stop

My config/puma.rb file is given below - 我的config / puma.rb文件在下面给出-

path_to_key="E:/ap01/OpenSSL-Win32/bin/server.key"
path_to_cert="E:/ap01/OpenSSL-Win32/bin/server.crt"
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup      DefaultRackup
port        ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
ssl_bind '127.0.0.1', '3000', { key: path_to_key, cert: path_to_cert }
on_worker_boot do

  ActiveSupport.on_load(:active_record) do
    config = ActiveRecord::Base.configurations[Rails.env] ||
                Rails.application.config.database_configuration[Rails.env]
    config['pool'] = ENV['MAX_THREADS'] || 5
    ActiveRecord::Base.establish_connection(config)
  end
end

The profile for foreman is given below - 领班简介如下:

 web: bundle exec puma -p $PORT -C config/puma.rb

I've also set config.force_ssl = true in my apps config/application.rb file. 我还在我的应用程序config / application.rb文件中设置了config.force_ssl = true。

Could you please advise what I'm missing here or doing incorrectly ?. 您能告诉我我在这里缺少什么还是做错了吗? Any pointers will be appreciated 任何指针将不胜感激

Thanks in Advance! 提前致谢!

You aren't doing anything wrong. 你没有做错任何事。 The browser doesn't trust your local certificate with your localhost, so it will give you a warning. 浏览器不信任本地主机的本地证书,因此会警告您。

But you can bypass it using the "Advanced" option on the page (left side bottom) and click proceed to view the ssl version of your application. 但是您可以使用页面(左侧底部)上的“高级”选项绕过它,然后单击继续以查看您的应用程序的ssl版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM