Report this

What is the reason for this report?

Ngnix Static File Caching (location)

Posted on September 18, 2014

Hi all! I follow this tutorial to optimize ngnix . In Static File caching section can you read:

It’s possible to set expire headers for files that don’t change and are served regularly. This directive can be added to the actual Nginx server block.

location ~* .(jpg|jpeg|png|gif|ico|css|js)$ { expires 365d; } Add and remove any of the file types in the array above to match the types of files your Nginx servers.

Where should be placed this?

If i put it in http block the nginx.conf fail! And i haven’t server block in my nginx.conf.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.