A
A
Alexander Lebedev2018-08-08 17:54:46
Nginx
Alexander Lebedev, 2018-08-08 17:54:46

How to work with cache in nginx?

Good afternoon. I'm making a website with Flask + Nginx. Nginx is configured to handle static files (images, css, js):

location /static {
        # handle static files directly, without forwarding to the application
        alias /home/user/www/site.com/app/static;
        expires 30d;
}

I make changes to the CSS, push to the server, reload Nginx, reload the supervisor, the site still returns the old CSS. How to work with it correctly? Delete the cache manually each time (the /var/cache/nginx directory does not exist)? Set expires 1s while development? Reload nginx with add. parameters?
I would be grateful for any advice :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Sergeev, 2018-08-08
@JetMaster

The browser caches.
At the time of development, connect scripts like this
where X is a random variable, usually timestamp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question