Too many define location directive

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Too many define location directive

antituhan
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello!

I got confused and no hint(s) about map directive co-exist with
try_files directive. Is it right to think using map directive? Or any
alternative?

The goals is, I want to avoid many location like :

... snip ...
        index   index.php;
        try_files $uri $uri/ /index.php?q=$uri&$args;
        root    /var/www/api.domain.tld;

        location /v2 {
                try_files $uri $uri/ /v2/index.php?q=$uri&$args;
        }

        location /v3 {
                try_files $uri $uri/ /v3/index.php?q=$uri&$args;
        }

location ~ \.php$ {
        fastcgi_param  SCRIPT_FILENAME
$document_root$fastcgi_script_name;
        ... rest fastcgi stuff there ...
}
...

That config above are works fine, but too many location "/v[0-9]+" in
config file. So, if there are v4, v5, etc are exists in
/var/www/api.domain.tld, the configuration won't change.

Any helps are appreciate.
Thanks.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQI4BAEBCAAiBQJY+5SqGxxkZXdhbmdnYWJhQHh0cmVtZW5pdHJvLm9yZwAKCRDl
f9IgoCjNcN9dEACak9z+gX1b0Jp+5iEM3vMx7iQMsIGjQc7CZ2+1bjlsYfYSdNsE
6v/T8Tc6e69aiKMrDF45a3CzW84FwTYdxD6u6Wg7SgrJhFfDLF+xltSKz17xa7C2
1ZdP1YTWHsu3XSbwtoERVcaX/nVgh66jpxCvNztUdcaeCKXWXiHZ4QB/tMMdS1+9
+b9uuoPDfgJaF42C3AbpjYNI6EanmVIBADu8Nkkx5apmr/QoBYLqFNPa3ShYkdzV
CD3m7pKILlfjo10w+1as1lNH9d6fFhD8fs12hbrkBtC1r/7ZigFCvsuuENokCamg
281qQeGg8jOUL9sHJLd9/S8q8991D8hUjmRPeQcjJ6pJC77Zxb+aw6WNu+v88/cL
6ePsbBNbXZGkwbVsXAqqFLcDhzA7gUEstz5pPbCyRmP5z6CQ+ruxwb817kf38aqq
rlTL4rDkR4hYWPbsUWOIAc56hQmG0bV45cieeMIy4a5t2ZsJVYxcvcdq8Jx3aXUM
fuy7qH5+yw//ISAdwHHgW3HNxXUxZFjYJ90wUtRk+UuEHWTwC0pfljb8u55kXBxK
Qj8lR8KWsPCgf374AgOvKHzqNMScZCAssH58RwOJ8raN4DLB+JHifSvRQeGeT7ma
EXkK3ET2alGn+XxaCO3p1sCQX275UcueJW2SIKVJOsq88GIZP1E16Q3Iyw==
=7AV6
-----END PGP SIGNATURE-----
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
[daemon@antituhan.com ~]#
Reply | Threaded
Open this post in threaded view
|

Re: Too many define location directive

Steve Holdoway
Hi,

On 23/04/17 05:36, Dewangga Bachrul Alam wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Hello!
>
> I got confused and no hint(s) about map directive co-exist with
> try_files directive. Is it right to think using map directive? Or any
> alternative?
>
> The goals is, I want to avoid many location like :
>
> ... snip ...
>          index   index.php;
>          try_files $uri $uri/ /index.php?q=$uri&$args;
>          root    /var/www/api.domain.tld;
>
>          location /v2 {
>                  try_files $uri $uri/ /v2/index.php?q=$uri&$args;
>          }
>
>          location /v3 {
>                  try_files $uri $uri/ /v3/index.php?q=$uri&$args;
>          }
>
> location ~ \.php$ {
>          fastcgi_param  SCRIPT_FILENAME
> $document_root$fastcgi_script_name;
>          ... rest fastcgi stuff there ...
> }
> ...
>
> That config above are works fine, but too many location "/v[0-9]+" in
> config file. So, if there are v4, v5, etc are exists in
> /var/www/api.domain.tld, the configuration won't change.
>
> Any helps are appreciate.
> Thanks.
>

use a map??

--
Steve Holdoway BSc(Hons) MIITP
https://www.greengecko.co.nz/
Linkedin: https://www.linkedin.com/in/steveholdoway
Skype: sholdowa

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx