E
E
emashev2019-07-29 18:08:48
Nginx
emashev, 2019-07-29 18:08:48

How to disable index.html caching in nginx?

Greetings, there is a site with Bitrix, there is a separate main page in html + js.
location @index - leads to the folder with the html page. The fact is that when this page is changed, nginx still gives the old version, while the browser cache is cleared and even through curl localhost - the old version is given.
There is a new version on the disk, and the old version in nginx, while there is no global cache in nginx, the /var/cache/nginx folders are also missing.
Where does it save the old copy of index.html?

server {

        listen 80 default_server;
        server_name _;

        index index.html index.php;
        root /var/www;

        set $php_sock unix:/tmp/php7.0-fpm.sock;

        location / {
               rewrite ^([^.\?]*[^/])$ $1/ permanent;
               try_files $uri $uri/ @index;
        }

        location ~ \.php$ {
                try_files       $uri @bitrix;
                fastcgi_pass    $php_sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

        location @bitrix {
                fastcgi_pass    $php_sock;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php;
        }

        location @index {
          root /var/www/index/spa/;
          add_header Cache-Control "no-store, no-cache, must-revalidate";
          expires -1;
          try_files $uri @bitrix;
        }

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
emashev, 2019-07-29
@emashev

In general, the problem is solved. It turned out that someone copied the old index.html to the root directory.
And he took it from there first.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question