如何使用Puma和Nginx部署rails应用程序

时间:2015-03-19 13:40:23

标签: ruby-on-rails nginx puma

我一直在关注这个tutorial部署一个rails 4应用程序,因为它不起作用而卡住了。

第一点:我还没有使用域名,只有一个IP号码 点拖曳:我使用的是default.conf nginx文件,它看起来像这样:

upstream turing {
  server unix:///var/run/turing.sock;
}

server {
  listen 80;
  server_name localhost; # change to match your URL
  root /var/www/turing/public; # I assume your app is located at that location

  location / {
    proxy_pass http://turing; # match the name of upstream directive which is defined above
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

  location ~* ^/assets/ {
    # Per RFC2616 - 1 year maximum expiry
    expires 1y;
    add_header Cache-Control public;

    # Some browsers still send conditional-GET requests if there's a
    # Last-Modified header or an ETag header even if they haven't
    # reached the expiry date sent in the Expires header.
    add_header Last-Modified "";
    add_header ETag "";
    break;
  }
}

当我访问IP地址时,我被重定向到https://ip地址并获得一个页面不可用。

如果我正常启动应用rails s并访问ipnumber:3000,该应用可按预期工作。

有人能说出我错过了什么吗?

非常感谢

0 个答案:

没有答案