1

I use nginx in my new project. I have a problem with nginx cache. Thant when I change static files, nginx load old files from cache. I use some command in nginx setting, but not work good.

nginx setup:

server {        # frontend
        listen       80;
        server_name  salary.iais.co;
        access_log   /var/log/nginx/salary.access.log;

        root /home/mgh/salary/salary-client;
        index /home/mgh/salary/salary-client/index.html;
    sendfile off;
    open_file_cache off;

# serve static files
        location ~ ^/(assets)/  {
                root    /home/mgh/salary/salary-client;
                expires off;
        sendfile off;
        open_file_cache off;
        }
location / {
#proxy_pass http://127.0.0.1:3000/;
    try_files $uri /index.html
    expires off;
    sendfile off;
    open_file_cache off;
  }
}

I use below command,

sendfile off;
open_file_cache off;

but not work well. I have too clear browser history to load new static files (like html, javascript and ...).

mgh
  • 921
  • 3
  • 9
  • 37
  • I user this [link](http://stackoverflow.com/questions/6236078/how-to-clear-the-cache-of-nginx), but not usefull. – mgh Dec 11 '16 at 14:45
  • For temp solution you can use developer tools in chrome if u're using chrome and under network tab check disable cache. – digit Dec 11 '16 at 15:07
  • 1
    Also try to manipulate headers by using expires epoche. You can refer this url [link](http://nginx.org/en/docs/http/ngx_http_headers_module.html) – digit Dec 11 '16 at 15:10
  • 1
    I cannot tell all user to disable chrome cache! – mgh Dec 11 '16 at 15:11
  • Oh i see. In that case u can take a look at ngx_http_headers or the link that i gaved you. You can set cache expired period. – digit Dec 11 '16 at 15:16

0 Answers0