Nginx不通过rails提供静态内容

时间:2016-10-24 13:36:54

标签: ruby-on-rails nginx routes

我想用nginx提供静态图像。我有我的nginx.conf

location /i/ {
      alias /home/matt/images/;
}

我要前往server.com/i/928675140291b6.jpg只是为了看看它是否会为图像服务,但我已经进入production.log

ActionController::RoutingError (No route matches [GET] "/i/928675140291b6.jpg"):

curl -I server.com/i/928675140291b6.jpg的回复:

HTTP/1.1 404 Not Found
Server: nginx/1.10.0 (Ubuntu)
Date: Mon, 24 Oct 2016 13:49:50 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 1564
Connection: keep-alive
X-Request-Id: abb0cb6c-e922-4186-b245-e78b21a88919
X-Runtime: 0.007451

1 个答案:

答案 0 :(得分:0)

我的问题是,出于某种原因,nginx doesen关心我的Rails项目文件夹中的nginx.conf。我在/etc/nginx/sites-enabled/my_app编辑了文件,现在nginx正在监听。