0
要在Sinatra和Unicorn和nginx中部署,当您访问相应的URL时,将始终请求成为“not_found”方法。在Sinatra和Unicorn以及Nginx上始终请求变为未找到方法
(例如:hogehoge.com/test/)
但是,当我本地测试,将进入正常“得到‘/’做”的方法。
你认为某处存在问题吗?
请告诉我。
[test.rb]
# coding: utf-8
require "sinatra"
require 'unicorn'
class Main < Sinatra::Application
get '/' do
'Success'
end
not_found do
'not_found'
end
end
[config.ru]
require './test'
run Main
[unicorn.rb]
@dir = "/var/www/Test"
worker_processes 2
working_directory @dir
preload_app true
timeout 30
listen "#{@dir}/tmp/test.sock", :backlog => 64
pid "#{@dir}/tmp/pids/unicorn.pid"
stderr_path "#{@dir}/log/unicorn.stderr.log"
stdout_path "#{@dir}/log/unicorn.stdout.log"
[nginx.conf]
location /test {
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://Test;
}
upstream Test {
server unix:/var/www/Test/tmp/test.sock;
}
我不使用独角兽,而是快速阅读他们的回合nt页面显示这不是在其下启动进程的常用方式。不要从'test.rb'中'要求';只需使用'unicorn -c unicorn.rb'在命令行运行它。它也可能更容易测试它*首先没有* nginx;因此在端口上启动独角兽而不是Unix套接字,然后卷曲它以查看您的端点是否正确解析。 – mwp