Rails 5.0.2部署数字海洋乘客问题

时间:2017-03-14 14:06:32

标签: ruby-on-rails nginx capistrano passenger web-deployment

我正在按照本教程在数字海洋上部署test rails 5.0应用程序:

  

https://gorails.com/deploy/ubuntu/16.04

我的代码在教程中是原样的,但在使用capistrano部署时,我得到以下登录乘客:restart。

There are no Phusion Passenger-served applications running whose paths begin with '/home/deploy/app_name''.

净效果是ip仍然显示Nginx欢迎页面。

欢迎所有输入。谢谢!

编辑:

00:56 passenger:restart
  01 passenger-config restart-app /home/deploy/app_name --ignore-app-not-running
  01 There are no Phusion Passenger-served applications running whose paths begin with '/home/deploy/app_name'.

修改2 /etc/nginx/sites-enabled/default

server {
        listen 80;
        listen [::]:80 ipv6only=on;

        server_name mydomain.com;
        passenger_enabled on;
        rails_env    production;
        root         /home/deploy/my_app_name/current/public;

        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
}

1 个答案:

答案 0 :(得分:0)

你需要这样的东西

server {
  listen       80;
  server_name  app_name.com;


  root /mnt/apps/app_name/current/public;

  passenger_enabled on;
  passenger_ruby /usr/bin/ruby2.0;

  proxy_set_header        Host            $host;
  proxy_set_header        X-Real-IP       $remote_addr;
  proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header        X-Forwarded-Proto $scheme;
  add_header              Front-End-Https   on;


  if ($request_method !~ "^(GET|POST|HEAD|PUT|DELETE|PATCH)$"){
    return 403;
  }

  rewrite /favicon.ico$ /favicon.ico break;
}