我可以使用THIN和
bundle exec thin start --ssl --ssl-verify --ssl-key-file /private/etc/apache2/ssl/server.key --ssl-cert-file /private/etc/apache2/ssl/server.crt
它在控制台/终端中工作,完美
但是当我尝试将这些选项附加在"运行/调试配置"中的rubymine中 - > "编辑脚本参数"我明白了:
/Users/jan/.rbenv/versions/1.9.3-p392/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/jan/RubymineProjects/myapp/script/rails server thin -b 0.0.0.0 -p 3000 -e development --ssl-verify --ssl-key-file /private/etc/apache2/ssl/server.key --ssl-cert-file /private/etc/apache2/ssl/server.crt
/Users/jan/.gem/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:33:in `parse!': invalid option: --ssl-verify (OptionParser::InvalidOption)
from /Users/jan/.gem/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:283:in `parse_options'
from /Users/jan/.gem/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:180:in `options'
from /Users/jan/.gem/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:54:in `set_environment'
from /Users/jan/.gem/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:42:in `initialize'
from /Users/jan/.gem/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `new'
from /Users/jan/.gem/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from /Users/jan/RubymineProjects/myapp/script/rails:6:in `require'
from /Users/jan/RubymineProjects/myapp/script/rails:6:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
流程以退出代码1结束 谁能帮助我们/我?
非常感谢!答案 0 :(得分:4)
使用以下方式
require 'rack'
SERVER_KEY = File.expand_path('../../ssl-cert/host.key', __FILE__)
SERVER_PEM = File.expand_path('../../ssl-cert/host.crt', __FILE__)
# Thin SSL workaround
module Rack
module Handler
class Thin
def self.run(app, options={})
app = Rack::Chunked.new(Rack::ContentLength.new(app))
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
options[:Port] || 3000,
app)
server.ssl = true
server.ssl_options = {
:private_key_file => SERVER_KEY,
:cert_chain_file => SERVER_PEM
}
yield server if block_given?
server.start
end
end
end
end
# Workaround end
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
答案 1 :(得分:3)
我在这里得到了帮助:
http://devnet.jetbrains.com/message/5490676
似乎Rubymine无法解析这些参数,但解决方法是使用运行/调试配置中的Ruby脚本执行此操作
答案 2 :(得分:1)
不应使用选项--ssl-verify
答案 3 :(得分:0)
显然这可以通过添加Procfile和gem工头来实现,就像在这组指令中一样:
Using Rails, Thin and SSL in RubyMine: The solution!
基本上,你将工头添加到你的Gemfile:
gem 'foreman'
然后在根目录中创建一个Procfile
(链接拼写错误),其中包含:
web: thin start --ssl
或者,如RubyMine通常那样绑定到0.0.0.0:
web: thin start -a 0.0.0.0 -p 3001 --ssl
我不需要指定我的ssl文件的位置,但是如果你想要它将是:
web: thin start -a 0.0.0.0 -p 3001 --ssl --ssl-key-file /private/etc/apache2/ssl/server.key --ssl-cert-file /private/etc/apache2/ssl/server.crt
我不建议使用--ssl-verify
,因为这对我不起作用。
最后,在RubyMine中,使用以下属性创建一个新的Ruby配置:
~/.rvm/gems/ruby-2.3.0@gemset/gems/foreman-0.82.0/bin/foreman
start
~/Sites/appname
在Bundler选项卡中,选中唯一复选框,以便在运行时使用bundle exec
。
最后,在日志选项卡中,添加指向~/Sites/appname/logs/development.log