Adding browser caching functionalities to nginx.conf

Hi All,

I am trying to edit the nginx.conf file in order to add some browser caching functionalities. To do this I added a rewrites.conf.j2 in the wordpress-setup folder as mentioned in the trellis docs.

roles/ wordpress-setup/ templates/ includes.d/ site1/ rewrites.conf.j2 proxy.conf.j2 site2/ rewrites.conf.j2

The rewrites.conf.j2 file contains the follwing code:

location ~* .(jpg|jpeg|png|gif|ico|css|js)$ { expires 365d; }

When I deploy the settings from above the my production environment it does not seem to be working.

It would be great if someone can help me out!

Quick note: my production environment is a DigitalOcean droplet with a Trellis / Bedrock setup.

Best Regards,

Tim Vrij

2 Likes

Just checking, by deploy you mean ansible-playbook server.yml -e env=production right?

Using deploy.sh will only effect changes to the app (theme, plugins, dependencies etc). You’ll need to run the ansible-playbook to update server configuration.

2 Likes

Thanks for your response Foxaii.

Actually I did ./deploy.sh production, which is quite stupid! :sleeping: :sleeping: :sleeping:

After running ansible-playbook server.yml -e env=production it seem to work perfectly!

I think this topic can be closed and once again, thank you!

1 Like