Rails 4.2使用SSL部署NGINX,Puma,Capistrano,RBenv - 403错误

时间:2015-06-19 18:07:58

标签: ruby-on-rails ssl nginx puma

我得到403 Forbidden。我检查了nginx/error.log并且禁止获取/home/deploy/apps/myapp/current/public/的目录索引 我有SSL并检查https://www.digicert.com/help/并查看我的证书设置好了。

我想知道是否可能是因为我的公共文件夹中没有任何index.html文件。我在Rails 4.2上运行。我的公开文件夹包含assets404.html422.html500.htmlfavicon.icorobots.txt

我的问题是,我应该做些什么来在我的公共文件夹中设置一个index.html,让我使用我的/app/views/static_pages/home.html.erb(在我的路由文件中设置为root static_pages#home) ?

我猜Nginx并不喜欢找不到index.html

我也进入了我的静态页面控制器并添加了:

def home

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

end

这是我没有SSL的nginx配置文件

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;
}

这是我的第一个Rails部署。我在Cloud9上使用SSH(使用capistrano,puma和nginx)在数字海洋液滴上进行部署。

0 个答案:

没有答案