Nginx, Passenger, Ruby on Rails 4.1.6 Ubuntu 14 - 403 forbidden error -


before posting question, did search on stackoverflow similar questions , did find quite few in spite of following advise given in them still error. recreated server 3 times scratch still end same error.

i'm getting following error while trying access website -

[error] 29931#0: *20 directory index of "/home/deploy/testapp/" forbidden,  

i'm on ubuntu 14.04, nginx, passenger , ruby on rails (4.1.6). created testapp on server under home/deploy folder using command

rails new testapp 

then created file under /etc/nginx/sites-available/testapp, contents follows-

server {    listen 80 default_server;    server_name 178.62.104.70;    passenger_enabled on;    #  #passenger_app_env development;    root /home/deploy/testapp; } 

i have installed ruby using rbenv , content of nginx.conf file -

user www-data; worker_processes 4; pid /run/nginx.pid;  events { worker_connections 768; # multi_accept on; }  http {  ## # basic settings ##  sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off;  # server_names_hash_bucket_size 64; # server_name_in_redirect off;  include /etc/nginx/mime.types; default_type application/octet-stream;  ## # ssl settings ## ssl_protocols tlsv1 tlsv1.1 tlsv1.2; # dropping sslv3, ref: poodle ssl_prefer_server_ciphers on;  ## # logging settings ##  access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log;  ## # gzip settings ##  gzip on; gzip_disable "msie6";  # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;  ## # nginx-naxsi config ## # uncomment if installed nginx-naxsi ##  #include /etc/nginx/naxsi_core.rules;  ## # phusion passenger config ## # uncomment if installed passenger or passenger-enterprise ##   passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini; # passenger_ruby /usr/bin/ruby; passenger_ruby  /home/deploy/.rbenv/shims/ruby;  ## # virtual host configs ##  include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*;  } 

update: command returned quite lot of results i'm displaying top level info

deploy@test:~$ ls -lr /home/deploy/testapp/ /home/deploy/testapp/: total 60 drwxrwxr-x 8 deploy deploy 4096 may 14 18:39 app drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 bin drwxrwxr-x 5 deploy deploy 4096 may 14 18:39 config -rw-rw-r-- 1 deploy deploy  154 may 14 18:39 config.ru drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 db -rw-rw-r-- 1 deploy deploy 1338 may 14 18:41 gemfile -rw-rw-r-- 1 deploy deploy 2895 may 14 18:41 gemfile.lock drwxrwxr-x 4 deploy deploy 4096 may 14 18:39 lib drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 log drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 public -rw-rw-r-- 1 deploy deploy  249 may 14 18:39 rakefile -rw-rw-r-- 1 deploy deploy  478 may 14 18:39 readme.rdoc drwxrwxr-x 8 deploy deploy 4096 may 14 18:39 test drwxrwxr-x 3 deploy deploy 4096 may 14 18:39 tmp drwxrwxr-x 3 deploy deploy 4096 may 14 18:39 vendor  /home/deploy/testapp/app: total 24 drwxrwxr-x 5 deploy deploy 4096 may 14 18:39 assets drwxrwxr-x 3 deploy deploy 4096 may 14 18:39 controllers drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 helpers drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 mailers drwxrwxr-x 3 deploy deploy 4096 may 14 18:39 models drwxrwxr-x 3 deploy deploy 4096 may 14 18:39 views  /home/deploy/testapp/app/assets: total 12 drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 images drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 javascripts drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 stylesheets  /home/deploy/testapp/app/assets/images: total 0  /home/deploy/testapp/app/assets/javascripts: total 4 -rw-rw-r-- 1 deploy deploy 664 may 14 18:39 application.js  /home/deploy/testapp/app/assets/stylesheets: total 4 -rw-rw-r-- 1 deploy deploy 683 may 14 18:39 application.css  /home/deploy/testapp/app/controllers: total 8 -rw-rw-r-- 1 deploy deploy  204 may 14 18:39 application_controller.rb drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 concerns  /home/deploy/testapp/app/controllers/concerns: total 0  /home/deploy/testapp/app/helpers: total 4 -rw-rw-r-- 1 deploy deploy 29 may 14 18:39 application_helper.rb  /home/deploy/testapp/app/mailers: total 0  /home/deploy/testapp/app/models: total 4 drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 concerns  /home/deploy/testapp/app/models/concerns: total 0  /home/deploy/testapp/app/views: total 4 drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 layouts  /home/deploy/testapp/app/views/layouts: total 4 -rw-rw-r-- 1 deploy deploy 297 may 14 18:39 application.html.erb  /home/deploy/testapp/bin: total 16 -rwxr-xr-x 1 deploy deploy 129 may 14 18:39 bundle -rwxr-xr-x 1 deploy deploy 220 may 14 18:39 rails -rwxr-xr-x 1 deploy deploy 164 may 14 18:39 rake -rwxr-xr-x 1 deploy deploy 461 may 14 18:39 spring  /home/deploy/testapp/config: total 36 -rw-rw-r-- 1 deploy deploy  978 may 14 18:39 application.rb -rw-rw-r-- 1 deploy deploy  170 may 14 18:39 boot.rb -rw-rw-r-- 1 deploy deploy  552 may 14 18:39 database.yml -rw-rw-r-- 1 deploy deploy  150 may 14 18:39 environment.rb drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 environments drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 initializers drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 locales -rw-rw-r-- 1 deploy deploy 1601 may 14 18:39 routes.rb -rw-rw-r-- 1 deploy deploy  964 may 14 18:39 secrets.yml  /home/deploy/testapp/config/environments: total 12 -rw-rw-r-- 1 deploy deploy 1422 may 14 18:39 development.rb -rw-rw-r-- 1 deploy deploy 3163 may 14 18:39 production.rb -rw-rw-r-- 1 deploy deploy 1661 may 14 18:39 test.rb  /home/deploy/testapp/config/initializers: total 32 -rw-rw-r-- 1 deploy deploy 377 may 14 18:39 assets.rb -rw-rw-r-- 1 deploy deploy 404 may 14 18:39 backtrace_silencers.rb -rw-rw-r-- 1 deploy deploy 128 may 14 18:39 cookies_serializer.rb -rw-rw-r-- 1 deploy deploy 194 may 14 18:39 filter_parameter_logging.rb -rw-rw-r-- 1 deploy deploy 647 may 14 18:39 inflections.rb -rw-rw-r-- 1 deploy deploy 156 may 14 18:39 mime_types.rb -rw-rw-r-- 1 deploy deploy 139 may 14 18:39 session_store.rb -rw-rw-r-- 1 deploy deploy 517 may 14 18:39 wrap_parameters.rb  /home/deploy/testapp/config/locales: total 4 -rw-rw-r-- 1 deploy deploy 634 may 14 18:39 en.yml  /home/deploy/testapp/db: total 4 -rw-rw-r-- 1 deploy deploy 343 may 14 18:39 seeds.rb  /home/deploy/testapp/lib: total 8 drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 assets drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 tasks  /home/deploy/testapp/lib/assets: total 0  /home/deploy/testapp/lib/tasks: total 0  /home/deploy/testapp/log: total 0  /home/deploy/testapp/public: total 16 -rw-rw-r-- 1 deploy deploy 1564 may 14 18:39 404.html -rw-rw-r-- 1 deploy deploy 1547 may 14 18:39 422.html -rw-rw-r-- 1 deploy deploy 1477 may 14 18:39 500.html -rw-rw-r-- 1 deploy deploy    0 may 14 18:39 favicon.ico -rw-rw-r-- 1 deploy deploy  202 may 14 18:39 robots.txt  /home/deploy/testapp/test: total 28 drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 controllers drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 fixtures drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 helpers drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 integration drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 mailers drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 models -rw-rw-r-- 1 deploy deploy  312 may 14 18:39 test_helper.rb  /home/deploy/testapp/test/controllers: total 0  /home/deploy/testapp/test/fixtures: total 0  /home/deploy/testapp/test/helpers: total 0  /home/deploy/testapp/test/integration: total 0  /home/deploy/testapp/test/mailers: total 0  /home/deploy/testapp/test/models: total 0  /home/deploy/testapp/tmp: total 4 drwxrwxr-x 3 deploy deploy 4096 may 14 18:39 cache  /home/deploy/testapp/tmp/cache: total 4 drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 assets  /home/deploy/testapp/tmp/cache/assets: total 0  /home/deploy/testapp/vendor: total 4 drwxrwxr-x 4 deploy deploy 4096 may 14 18:39 assets  /home/deploy/testapp/vendor/assets: total 8 drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 javascripts drwxrwxr-x 2 deploy deploy 4096 may 14 18:39 stylesheets  /home/deploy/testapp/vendor/assets/javascripts: total 0  /home/deploy/testapp/vendor/assets/stylesheets: total 0 

you should point root public directory:

server {    listen 80 default_server;    server_name 178.62.104.70;    passenger_enabled on;    #  #passenger_app_env development;    root /home/deploy/testapp/public; #notice public here } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -