To be deployed in the Sinatra and Unicorn and nginx, when you access to the appropriate URL, will always request becomes "not_found do" method.
(For Example: hogehoge.com/test/)
But, When I have tested locally, it will enter to properly "get '/' do" method.
Do you think that somewhere there is a problem with?
Please tell me.
[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;
}
different nginx path & rb path
(For Example: hogehoge.com/test/)
[test.rb]
# coding: utf-8
require "sinatra"
require 'unicorn'
class Main < Sinatra::Application
get '/' do
'Success'
end
get '/test' do
'test Success'
end
not_found do
'not_found'
end
end
add
get '/test' do
'test Success'
end