gpt4 book ai didi

Ruby+Sinatra+nginx=403 禁止访问

转载 作者:太空宇宙 更新时间:2023-11-03 16:22:08 24 4
gpt4 key购买 nike

我已经安装了 ruby​​+nginx server+sinatra,但目前我遇到了 403 forbidden 错误。日志说:

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

我做错了什么?

最佳答案

转到您的 nginx 配置文件,并添加 user your_user_name; 作为第一行更新:保存并重新启动服务器。

如果这不起作用,请使用

授予对 /home/ruby-deployer/sin-app/hello 的更多访问
chmod 755 /home/ruby-deployer/sin-app/hello

关于Ruby+Sinatra+nginx=403 禁止访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31877647/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com