Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: Serve Image files only

$
0
0
nginx_user10 Wrote:
-------------------------------------------------------
> I am trying to serve images files only in this location block.
>
> location /image \.(png|jpg)
> {
> alias /site/;
> }
>
> But I keep receiving errors. What is the correct way to serve only png
> and jpg matching /images.


*********************** update *************************

This location block works if I put a redirect in the block. But if I try to show the image via <img src or make a link clickable nothing works.

location ~* /images2/.+\.(png|jpg)$
{
}

The error logs says the following

GET /images2/flowers/type/T.png/ HTTP/1.1" 404 209

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>