E
E
Eugene2019-11-07 08:57:49
Nginx
Eugene, 2019-11-07 08:57:49

How to make sure that index.php in the root folder is not cached?

How to make sure that index.php in the root folder is not cached?

location / {
    		try_files $uri $uri/ /index.php?$args;
 }

    location ~ \.php$ {
    try_files $uri =404;

    include snippets/fastcgi-params.conf;

    fastcgi_pass unix:/run/php/php7.3-fpm.sock;

    # Skip cache based on rules in snippets/fastcgi-cache.conf.
    fastcgi_cache_bypass $skip_cache;
    fastcgi_no_cache $skip_cache;

    # Define memory zone for caching. Should match key_zone in fastcgi_cache_path above.
    fastcgi_cache fraktal;

    # Define caching time.
    fastcgi_cache_valid 60m;
    #increase timeouts
    fastcgi_read_timeout 6000;
    fastcgi_connect_timeout 6000;
    fastcgi_send_timeout 6000;
    proxy_read_timeout 6000;
    proxy_connect_timeout 6000;
    proxy_send_timeout 6000;
    send_timeout 6000;

    #these lines should be the ones to allow Cloudflare Flexible SSL to be used so the server does not need to decrypt SSL
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-NginX-Proxy true;

    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Dmitriev, 2019-11-07
@SignFinder

create a location for index.php and add
add_header Cache-Control no-cache there;
and you can still
expires 1s;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question