Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sinatra on Nginx configuration - what's wrong?

I followed this tutorial more or less... I installed the passenger gem, executed passenger-install-ginx-module, sucessfully installed nginx and inserted this into the config:

server {
  listen 80;
  server_name localhost;
  root /home/admin/sintest/public;   # <--- be sure to point to 'public'!
  passenger_enabled on;
}

In /home/admin/sintest I have: an empty public folder, the config.ru:

require 'sinatra'

set :env,  :production
disable :run

require './app.rb'    #the app itself

run Sinatra::Application

and a test sinatra app.rb:

require 'sinatra'

get '/' do
  "hello world!"
end

Now when I run nginx and open up http://localhost what I get is: 403 Forbidden

What am I doing wrong? Have I missed something?

like image 715
apirogov Avatar asked Sep 14 '10 16:09

apirogov


2 Answers

Make sure that the user nginx is running as (in most cases 'nobody' or 'www-data') has permission to read the contents of your home directory /home/admin.

Also you can look into the nginx logs and read exactly what the error was.

like image 192
lest Avatar answered Nov 03 '22 23:11

lest


I had the same error until I added passenger_root and passenger_ruby directives in the http block.

like image 33
jbasko Avatar answered Nov 04 '22 01:11

jbasko