帮助使用 Sinatra 启动我的瘦服务器
我是一个新人,试图熟悉 Ruby 和 Sinatra。我按照 Slicehost 文章设置了 Ruby 1.9.1 和 Thin 1.2.7,并使用 Nginx 的反向代理。
在我尝试启动我的瘦服务器之前,大多数事情都进展得很顺利。
这是我从日志中得到的输出:
$ sudo thin -C config.yml -R config.ru start
/home/user/public_html/testapp/config.ru:9:in `block in <main>': undefined method `application' for Sinatra:Module (NoMethodError)
from /var/lib/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /var/lib/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from /home/user/public_html/testapp/config.ru:1:in `new'
from /home/user/public_html/testapp/config.ru:1:in `<main>'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/rack/adapter/loader.rb:36:in `eval'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/rack/adapter/loader.rb:36:in `load'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:175:in `load_rackup_config'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:65:in `start'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'
from /usr/bin/thin:19:in `load'
from /usr/bin/thin:19:in `<main>'
如果有人需要,我可以发布我的 config.yml、config.ru 和 myapp.rb,其中包含我的 Sinatra 代码(基本上是从 Sinatra 书的顶部摘录的示例代码)看看它,但如果你对基于该日志本身发生的事情有任何想法,我将不胜感激,因为我在全球谷歌上找不到任何东西。
另外,这仍然是在精简环境下运行 Sinatra 的首选方式吗?
我只需通过 Ruby 本身运行该应用程序就可以工作:
$ ruby myapp.rb
== Sinatra/1.0 has taken the stage on 4567 for development with backup from Thin
这使我可以在沙箱中查看我的页面。
谢谢大家。
I'm a newcomer trying to get my feet wet with Ruby and Sinatra. I followed the Slicehost articles in getting Ruby 1.9.1 setup along with Thin 1.2.7 with a reverse proxy to Nginx.
Most things were going pretty smooth until I tried to start up my thin server.
This is the output I get from my logs:
$ sudo thin -C config.yml -R config.ru start
/home/user/public_html/testapp/config.ru:9:in `block in <main>': undefined method `application' for Sinatra:Module (NoMethodError)
from /var/lib/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /var/lib/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from /home/user/public_html/testapp/config.ru:1:in `new'
from /home/user/public_html/testapp/config.ru:1:in `<main>'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/rack/adapter/loader.rb:36:in `eval'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/rack/adapter/loader.rb:36:in `load'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:175:in `load_rackup_config'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:65:in `start'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
from /var/lib/gems/1.9.1/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'
from /usr/bin/thin:19:in `load'
from /usr/bin/thin:19:in `<main>'
I can post my config.yml, config.ru and myapp.rb, where my Sinatra code resides (it's basically the sample code ripped from the top of the Sinatra book), if anyone needs to see it, but if you have any ideas on what's going on based on that log itself, I'd appreciate it, as I couldn't find anything on the world wide Google.
Also, is this still the preferred way of running Sinatra on thin?
I can get the app working with just running it through Ruby itself:
$ ruby myapp.rb
== Sinatra/1.0 has taken the stage on 4567 for development with backup from Thin
This allows me to see my pages in my sandbox.
Thank you, all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每当您遇到问题并想知道它是否与 1.8 和 1.9 相关时,请检查以下站点:
http:// isitruby19.com/thin
Any time you have an issue and are wondering if it could be related to 1.8 vs 1.9, check the following site:
http://isitruby19.com/thin