Question
Ngnix Static File Caching (location)
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.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×