A
A
Andrey2020-07-21 14:51:10
Nginx
Andrey, 2020-07-21 14:51:10

Am I setting the variable value correctly for try_files in NGINX?

I'm trying to include the WP SuperCache module via include. Here is such a design:

server {
....
    # Enable WP SuperCache
    include common/wp-supercache;

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

....
}


The $gzipcachefile and $cachefile variables are defined inside the included file. I want to make the process more flexible, so if I comment out the include line, the standard try_files $uri $uri/ /index.php?$args;

To do this, as I understand it, you can define the $gzipcachefile and $cachefile variables before connecting the file, then NGINX will not swear that $gzipcachefile and $cachefile are not defined. But what value should they be set to? If I put set $gzipcachefile ""; , then what will he take? Is it possible to somehow deduce which parameter ended up in try_files?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question