如何使用Nginx在Passenger中运行Sinatra App?

时间:2016-06-01 11:40:12

标签: ruby nginx sinatra passenger

我试图使用我现有的Nginx& amp尝试运行一个非常简单的Sinatra应用程序。乘客设置。我熟悉在Passenger上运行Rails,但这是我第一次设置Sinatra。

我已经通过bundler和RVM安装了Sinatra。看看我的配置并告诉我我做错了什么。

Nginx conf:

server {
  listen       80;
  server_name  demo.my-example.com;
  root /home/user/demo.my-example.com/sinatra;     

  passenger_ruby /usr/local/rvm/wrappers/ruby-2.3.1@my_gemset/ruby;
  passenger_enabled on;
}

/home/user/demo.my-example.com/sinatra/config.ru

require 'rubygems'
Gem.clear_paths
disable :run, :reload
set :environment, :production

require "./stripe"
run StripeApp

/home/user/demo.my-example.com/sinatra/stripe.rb

require 'sinatra/base'
class StripeApp < Sinatra::Base
  get '/' do 
   "Hello world"
  end
end

1 个答案:

答案 0 :(得分:0)

/home/user/demo.my-example.com/sinatra/config.ru

require 'rubygems'
Gem.clear_paths

require "./stripe"
run StripeApp