Sinatra关于Nginx的配置-怎么了? [英] Sinatra on Nginx configuration - what's wrong?

查看:76
本文介绍了Sinatra关于Nginx的配置-怎么了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我关注了

I followed this tutorial more or less... I installed the passenger gem, executed passenger-install-ginx-module, sucessfully installed nginx and inserted this into the config:

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:

In /home/admin/sintest I have: an empty public folder, the config.ru:

require 'sinatra'

set :env,  :production
disable :run

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

run Sinatra::Application

和一个测试sinatra app.rb:

and a test sinatra app.rb:

require 'sinatra'

get '/' do
  "hello world!"
end

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

Now when I run nginx and open up http://localhost what I get is: 403 Forbidden

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

What am I doing wrong? Have I missed something?

推荐答案

请确保用户nginx以(大多数情况下为"nobody"或"www-data")具有读取主目录内容的权限的身份运行/home/admin.

Make sure that the user nginx is running as (in most cases 'nobody' or 'www-data') has permission to read the contents of your home directory /home/admin.

此外,您还可以查看nginx日志并准确读取错误的原因.

Also you can look into the nginx logs and read exactly what the error was.

这篇关于Sinatra关于Nginx的配置-怎么了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆