Rails 4.2 Deploy NGINX, Puma, Capistrano, RBenv with SSL - 403 errors

918 views Asked by At

I am getting 403 Forbidden. I have checked my nginx/error.log and get directory index of /home/deploy/apps/myapp/current/public/ is forbidden I have SSL and did a check on https://www.digicert.com/help/ and see my certificates are set up OK.

I am wondering if it could be be perhaps because I don't have any index.html file in my public folder. I am running on Rails 4.2. My public folder has assets, 404.html, 422.html, 500.html, favicon.ico and robots.txt.

My question is, should I be doing something to set up an index.html in my public folder that lets me use my /app/views/static_pages/home.html.erb (set up as root static_pages#home in my routes file)?

I would guess Nginx isn't liking that there is not an index.html to find.

I also went into my static pages controller and added:

def home

render :file => 'public/index.html'

end

This is my nginx config file without SSL

upstream puma {
  server unix:///home/laurie/apps/creativehub/shared/tmp/sockets/creativehub-puma.sock;
}

server {
  listen 80 default_server deferred;
  server_name creativecalgary.ca www.creativecalgary.ca;



  root /home/laurie/apps/creativehub/current/public;
  access_log /home/laurie/apps/creativehub/current/log/nginx.access.log;
  error_log /home/laurie/apps/creativehub/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://puma;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 10;
}

This is my first Rails deploy. I am deploying on a digital ocean droplet using SSH on Cloud9 (with capistrano, puma, and nginx).

0

There are 0 answers