Title: Error activating browser caching
Last modified: May 26, 2020

---

# Error activating browser caching

 *  Resolved [fredperes](https://wordpress.org/support/users/fredperes/)
 * (@fredperes)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/error-activating-browser-caching/)
 * Hi!
    I tried to activate the browsing cache but nginx got an error:
 * nginx: [emerg] “location” directive is not allowed here in /etc/nginx/nginx.conf:
   87
 * It would be:
 * location ~* \.(txt|xml|js)$ {
    expires 1y; }
 * What’s wrong?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ferror-activating-browser-caching%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Predrag – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support1/)
 * (@wpmudev-support1)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/error-activating-browser-caching/#post-12898465)
 * Hi [@fredperes](https://wordpress.org/support/users/fredperes/),
 * Browser Caching rules depend on your server settings and error like that usually
   suggests that the rules were added in the wrong place.
 * Can you get in touch with your hosting provider and ask them to apply the caching
   rules for you so you can be sure they are added in a proper place?
 * Cheers,
    Predrag
 *  Thread Starter [fredperes](https://wordpress.org/support/users/fredperes/)
 * (@fredperes)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/error-activating-browser-caching/#post-12899366)
 * Looked like the issue was in cloudflare (the website is hosted in digital ocean
   + CDN cloudflare). When I connected the cloudflare’s API, the problem was solved.
 *  Plugin Support [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * (@wpmudev-support8)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/error-activating-browser-caching/#post-12906780)
 * Hi [@fredperes](https://wordpress.org/support/users/fredperes/)
 * I’m glad to hear the issue is solved and thank you for letting us know!
 * I’ll close this thread for now but if you’ll need any further help with this,
   please don’t hesitate to re-open it or start a new one.
 * Best regards,
    Adam

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Error activating browser caching’ is closed to new replies.

 * ![](https://ps.w.org/hummingbird-performance/assets/icon-256x256.gif?rev=2633221)
 * [Hummingbird Performance - Cache & Page Speed Optimization for Core Web Vitals | Critical CSS | Minify CSS | Defer CSS Javascript | CDN](https://wordpress.org/plugins/hummingbird-performance/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hummingbird-performance/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hummingbird-performance/)
 * [Active Topics](https://wordpress.org/support/plugin/hummingbird-performance/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hummingbird-performance/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hummingbird-performance/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/error-activating-browser-caching/#post-12906780)
 * Status: resolved