Jerrold Thompson
2012-Dec-04 21:57 UTC
403 Forbidden from nginx when unicorn started in debug mode
I am using nginx with unicorn as a reverse proxy.
Has been fantastic, but needed to look through some code
for first time.
Using ruby 1.9.3p194 with rails 3.2.9, development mode with ssl enabled,
I start unicorn with -d
...and it does not get served up by nginx.
Any ideas, or more information needed?
Thanks!
Jet
Below is my unicorn.rb for developent:
# config/unicorn.rb
env = "development"
preload_app true
timeout 30
listen "/tmp/unicorn.sock", :backlog => 64
if env == ''development''
pid
"/home/jet/RailsApps/spree/aceleathergoods/tmp/pids/unicorn.aceleathergoods.pid"
stderr_path
"/var/www/aceleathergoods/shared/log/unicorn.stderr.log"
stdout_path
"/var/www/aceleathergoods/shared/log/unicorn.stdout.log"
end
before_fork do |server, worker|
if defined?(ActiveRecord::Base)
ActiveRecord::Base.connection.disconnect!
end
old_pid = "#{shared_path}/pids/unicorn.aceleathergoods.pid.oldbin"
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
# someone else did our job for us
end
end
end
after_fork do |server, worker|
if defined?(ActiveRecord::Base)
ActiveRecord::Base.establish_connection
end
end
Jerrold Thompson
2012-Dec-04 22:01 UTC
403 Forbidden from nginx when unicorn started in debug mode
...in Gemfile: gem ''debugger'', :git => ''git://github.com/cldwalker/debugger.git'', :require => ''debugger'' On 12/04/2012 01:57 PM, Jerrold Thompson wrote:> I am using nginx with unicorn as a reverse proxy. > > Has been fantastic, but needed to look through some code > for first time. > > Using ruby 1.9.3p194 with rails 3.2.9, development mode with ssl enabled, > > I start unicorn with -d > > ...and it does not get served up by nginx. > > Any ideas, or more information needed? > > Thanks! > > Jet > > Below is my unicorn.rb for developent: > > # config/unicorn.rb > > env = "development" > > preload_app true > > timeout 30 > > listen "/tmp/unicorn.sock", :backlog => 64 > > if env == ''development'' > pid > "/home/jet/RailsApps/spree/aceleathergoods/tmp/pids/unicorn.aceleathergoods.pid" > > stderr_path "/var/www/aceleathergoods/shared/log/unicorn.stderr.log" > stdout_path "/var/www/aceleathergoods/shared/log/unicorn.stdout.log" > end > > > before_fork do |server, worker| > if defined?(ActiveRecord::Base) > ActiveRecord::Base.connection.disconnect! > end > > old_pid = "#{shared_path}/pids/unicorn.aceleathergoods.pid.oldbin" > if File.exists?(old_pid) && server.pid != old_pid > begin > Process.kill("QUIT", File.read(old_pid).to_i) > rescue Errno::ENOENT, Errno::ESRCH > # someone else did our job for us > end > end > end > > after_fork do |server, worker| > if defined?(ActiveRecord::Base) > ActiveRecord::Base.establish_connection > end > end >
Eric Wong
2012-Dec-05 00:10 UTC
403 Forbidden from nginx when unicorn started in debug mode
Jerrold Thompson <jet at whidbey.com> wrote:> I am using nginx with unicorn as a reverse proxy. > > Has been fantastic, but needed to look through some code > for first time. > > Using ruby 1.9.3p194 with rails 3.2.9, development mode with ssl enabled, > > I start unicorn with -d > > ...and it does not get served up by nginx. > > Any ideas, or more information needed?Can you check your nginx error_log? This is probably an error in the nginx configuration.> if env == ''development'' > pid "/home/jet/RailsApps/spree/aceleathergoods/tmp/pids/unicorn.aceleathergoods.pid" > stderr_path "/var/www/aceleathergoods/shared/log/unicorn.stderr.log" > stdout_path "/var/www/aceleathergoods/shared/log/unicorn.stdout.log"In case nginx is configured correctly, maybe the output of stderr can tell you something.