U
U
un1t2015-10-31 11:45:08
Nginx
un1t, 2015-10-31 11:45:08

Is it possible to override the inheritance of lokeshens without copy-paste?

Here is about this kind of config.

server {
    listen 80;
    server_name example.com;

    location / {
        proxy_cache site;
        proxy_cache_bypass $cookie_sessionid;
        proxy_cache_valid 3s;
        proxy_cache_valid 200 3s;
        proxy_pass     http://127.0.0.1:8111;

        location /page2/ {
            proxy_cache_valid 200 1m;
        }
    }

I want to override the cache lifetime for /page2/, but inherit all other parameters from "location /".
This example does not work, you have to copy-paste all other settings for /page2/.
It only comes to mind to take it out to another file and include it, but I don’t really like this idea.
Are there any other options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arman, 2015-10-31
@Arik

as an option, you can put it in a separate file and make include in both locations and what needs to be reassigned already

S
ShamblerR, 2015-11-02
@ShamblerR

mde of course you can include /conf/file.conf;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question