简体   繁体   English

Nginx不通过rails提供静态内容

[英]Nginx not serving static content over rails

I want to serve static images with nginx. 我想用nginx提供静态图像。 I have in my nginx.conf 我在我的nginx.conf中

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

I am going to server.com/i/928675140291b6.jpg Just to see if it will serve the image, But I'm getting in production.log : 我要去server.com/i/928675140291b6.jpg看看它是否会提供图像,但我要进入production.log

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

The response to curl -I server.com/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

My problem was, for some reason, nginx doesen't care about the nginx.conf in my Rails project folder. 我的问题是,出于某种原因,nginx并不关心我的Rails项目文件夹中的nginx.conf I edited the file in /etc/nginx/sites-enabled/my_app and now nginx is listening. 我在/etc/nginx/sites-enabled/my_app编辑了文件,现在nginx正在监听。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM