【问题标题】:Sinatra on Nginx configuration - what's wrong?Nginx 配置上的 Sinatra - 出了什么问题?
【发布时间】:2011-04-12 06:24:33
【问题描述】:

我或多或少地遵循了this教程...我安装了passenger gem,执行了passenger-install-ginx-module,成功安装了nginx并将其插入到配置中:

server {
  listen 80;
  server_name localhost;
  root /home/admin/sintest/public;   # <--- be sure to point to 'public'!
  passenger_enabled on;
}

在 /home/admin/sintest 我有:一个空的公用文件夹, config.ru:

require 'sinatra'

set :env,  :production
disable :run

require './app.rb'    #the app itself

run Sinatra::Application

还有一个测试 sinatra app.rb:

require 'sinatra'

get '/' do
  "hello world!"
end

现在当我运行 nginx 并打开 http://localhost 时,我得到的是:403 Forbidden

我做错了什么?我错过了什么吗?

【问题讨论】:

    标签: ruby nginx sinatra


    【解决方案1】:

    确保用户 nginx 正在运行(在大多数情况下为“nobody”或“www-data”)有权读取您的主目录 /home/admin 的内容。

    您还可以查看 nginx 日志并准确阅读错误内容。

    【讨论】:

    • 2010/09/14 18:36:04 [error] 12131#0: *2 "/home/admin/sintest/public/index.html" 被禁止(13:权限被拒绝),客户端:127.0.0.1,服务器:localhost,请求:“GET / HTTP/1.1”,主机:error.log 中的“localhost”...但它应该使用 sinatra 评估 url?这就是乘客的全部意义所在?
    • 我不知道 nginx 默认以无人身份运行...好的,我已修复...谢谢
    【解决方案2】:

    在我在 http 块中添加乘客根和乘客红宝石指令之前,我遇到了同样的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-29
      • 2021-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-03
      相关资源
      最近更新 更多