nginx serving corrupt images

Maxim Dounin mdounin at mdounin.ru
Thu Feb 23 13:02:48 UTC 2023


Hello!

On Thu, Feb 23, 2023 at 01:32:06PM +0200, Reinis Rozitis wrote:

> > Question:
> > if I don't have any like inside de 
> > location / {}
> > how does nginx delivers an html file out of many possibly found in the root for the location?
> 
> There is generally no need to specify location / { .. } if you don't provide any specific configuration or behavior for it.
> 
> Having just:
> 
> server { 
> root /some/path;
> }
> 
> is enough to serve (static) files.  

I would rather recommend to always specify at least "location /", 
even if it's empty.

While not specifying any locations mostly works, this causes nginx 
to process requests in the "server location", which was originally 
introduced as a purely technical one.  Trying to process requests 
in it might have various associated bugs.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list