Question

Delete Cache Nginx (Not a virtual box)

Hey folks. I’m running a Laravel Site (Ubuntu) on Nginx (Not a virtual box). When I make changes to a css file, or any file for that matter i’m unable to see the changes right away. I’ve tried changing sendfile from on to off as noted in this link:

http://stackoverflow.com/questions/6236078/how-to-clear-the-cache-of-nginx

And I couldn’t find a Nginx cache file to delete the cache. Many sites recommend going to the “path/to/cache” folder but I can’t find it:

https://www.nginx.com/blog/nginx-caching-guide/

Anyway I don’t believe I set up any kind of proxy caching or anything. Any ideas where I can find my cache so I can delete it folks? For that matter am I looking to do the correct thing here? Thanks for you answer in advance.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Nginx doesn’t do any caching by default. If you haven’t set any caching up in nginx, what makes you think it’s caching anything? And what issue are you trying to solve here that needs this cache cleared?

In my case the issue was related to opcache. Disabling it in /etc/php/7.2/fpm/php.ini:

opcache.enable=0

does let load the server the latest version of the (php) files again.

Someone gave me a good answer to my question (because i’m using laravel) on stackoverflow. I’ll share the answer for someone looking but it still didn’t solve my problem:

First, css is something that the client caches, not the server. You should clear your browser’s cache to see your css changes. Furthermore, browser caching is a common problem in css and javascript development. Luckily, you can take advantage of elixir, which ships with laravel 5.1, to prevent browsers caching your assets.

Visit the docs for more info on laravel elixir.

http://laravel.com/docs/5.1/elixir#versioning-and-cache-busting

Second, laravel gives us a convenient command to clear your server’s cache:

php artisan cache:clear