W
W
Webber2021-06-03 22:31:42
Nginx
Webber, 2021-06-03 22:31:42

How to remove duplicate properties?

There is a config in which many locales repeat almost all parameters, is it possible to make them inherit?

location ~ ^/api1/(.*) {
        set $upstream 127.0.0.1:9000;

        rewrite ^/api1/(.*)$ /$1 break;
        fastcgi_pass $upstream;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /var/www/public/index.php;
        fastcgi_param REQUEST_URI $uri$is_args$args;

        access_log /var/log/nginx/access_custom.log main;
    }

    location ~ ^/api2/(.*) {
        set $upstream 127.0.0.2:9000;

        rewrite ^/api2/(.*)$ /$1 break;
        fastcgi_pass $upstream;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /var/www/public/index.php;
        fastcgi_param REQUEST_URI $uri$is_args$args;

        access_log /var/log/nginx/access_custom.log main;
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2021-06-03
@AKLZephyr

You can, just take the duplicate parameters to a higher level. Well, or in a separate file of them - and included.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question