I want to serve static images with nginx. I have in my 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
:
ActionController::RoutingError (No route matches [GET] "/i/928675140291b6.jpg"):
The response to 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. I edited the file in /etc/nginx/sites-enabled/my_app
and now nginx is listening.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.