L
L
Lesha Kiselev2014-10-14 11:40:36
PHP
Lesha Kiselev, 2014-10-14 11:40:36

How to forward args for the specified location in nginx?

There is an nginx config:

...
root /var/www/site.ru/

location / {
    try_files $uri $uri/ =404;
}

location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass pool;
        fastcgi_index index.php;
        include fastcgi_params;
}

...

How to forward $args to a request for a specific location?
Need something like this:
location ~  ^/test.* {
    root /var/www/site.ru/public/
    try_files $uri $uri/ /index.php?$args;
}

This approach doesn't work.
Main url: site.ru/any/folders/script.php
For test: site.ru/test/public/index.php/route/controller/data

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Misbakh-Soloviev, 2014-10-15
@mva

What about

location ~  ^/test(.*) {
    root /var/www/site.ru/public/
    try_files $uri $uri/ /index.php?$1;
}

? :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question