【发布时间】:2015-10-30 21:26:48
【问题描述】:
我已经安装了 ruby+nginx server+sinatra,但目前我遇到了 403 禁止错误。日志说:
2015/08/07 15:03:07 [error] 2902#0: *4 directory index of "/home/ruby-deployer/sin-app/hello/" is forbidden, client: ::1, server: 172.17.0.252, request: "GET / HTTP/1.0", host: "localhost"
我的虚拟主机配置:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name 172.17.0.252;
passenger_enabled on;
rails_env production;
root /home/ruby-deployer/sin-app/hello;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
nginx.conf:
##
# Phusion Passenger config
##
# Uncomment it if you installed passenger or passenger-enterprise
##
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/ruby-deployer/.rvm/gems/ruby-2.2.2/wrappers/ruby;
你好/app.rb:
require 'sinatra'
get '/' do
'Hello world!'
end
你好/config.ru:
require 'rubygems'
require 'sinatra'
require './app.rb'
run Sinatra::Application
我做错了什么?
【问题讨论】:
-
我想说这个问题应该属于serverfault
-
首先在 nginx 中添加第一行用户 your_username,如果它不起作用 chmod 应用程序所在的文件夹
-
chmod 777 - 这是我检查的第一件事
标签: ruby nginx sinatra passenger