open_file_cache issues on Nginx + solution

Last few updates of BB caused issues not encountered before. Turned out to be an issue with the nginx open_file_cache setting.

Solution in this case was to add open_file_cache off; to the css/js location block.

location ~* \.(css|js)$ {
    open_file_cache off;
    fastcgi_cache_bypass 1;
    fastcgi_no_cache 1;
}

Hey Daan,

Welcome to BB Forums! Just letting you know I’m checking in with the team on this one.

Thanks!

KC

Hey Daan,

Thanks for sharing! So cool of you to do so as there aren’t really nginx users within the BB team. :slight_smile: If it isn’t too much to ask, do you also mind sharing the issue that would require this solution? :slight_smile:

Ben

Hi Ben,

I have issues with BB and nginx caching. As it turns out the solution above only partly fixes my problem.

Example:

  • activate BB on a page
  • change a color of a heading (or anything else CSS)
  • color changes in live
  • now save the modal
  • color reverts back to previous color
  • finish BB
  • color is now correct

Obviously this makes editing very hard.

Somewhere BB doesn’t update the modified CSS or nginx is caching only that specific CSS. Could it be that the CSS is generated in a php file? (eg: somefile.php?css=x).

Fixed by moving the open_file_cache off; and sendfile off; directives to the http block in nginx.conf.

Hey Daan,

Again, thanks so much for sharing the solution. :slight_smile:

Ben

Sure, you’re welcome. I need to do some further testing to optimize the solution as I suspect it can be done without hurting performance. Not a huge priority as those directives are more important for high traffic sites that have no use for BB. Those kind of sites tend to use other building methods.

You’re welcome to contact me when confronted with obscure nginx issues.