Enabling Response/Header Caching Policy on Bitnami NGINX Image

Keywords: Nginx - Virtual Machines - How to - Other
Description:
We are preparing a new NGINX box for a static website. We would like to implement caching of our web content to make things faster using localized caching polices that get sent in the header.

What are the guides or steps to implement this as natively and as lightly as possible?

For context I had tried to follow this:
https://www.youtube.com/watch?v=utdkGzmg1-Y&t=304s

However it seems I could not write anything into the nginx cache folder in var, and I therefore made no progress after multiple attempts to update permissions.

Hello @ISB,

We have a guide on how to Configure And Use Varnish™ With NGINX, which may be a good solution to your needs.

Could you share the commands you tried to modify NGINX configuration and the errors shown? Keep in mind that, as opposed to the linked video, you need to run the commands with sudo to have root permissions.

Regards,
Francisco de Paz

Thanks I’ll try again with sudo.

Do the config file locations make sense, or should this all be baked into the existing nginx.conf? I understand that Bitnami does not use available sites and sites enabled folders? Is the var/cache location acceptable or should I use the setup from Varnish instead?

Separately, is Varnish the recommended way to go? Should I rather be pursuing that solution or is Tony’s approach also okay?

Hi @ISB,

I recommend adding the configuration options to the nginx.conf file.

We currently don’t have any documentation on Nginx server caching besides using Varnish, but it would be great if you could try it. (Maybe back up the configuration files first) If it’s a working solution then we can add it to our documentation.

This depends on the situation. Varnish is a good solution for caching content, but if possible try both.

Regards,
Michiel