U
U
uralmas2018-09-08 16:24:50
Nginx
uralmas, 2018-09-08 16:24:50

How to organize multiple locations for php?

I want to set up the site config so that different sections with php are processed differently (different settings)

location ~* /forum/index.php$ {
  ...
}
location ~* /forum/(admin|css|sitemap).php$ {
  ...
}
location /sources/skin.php {
  ...
}
location / {
  location ~ [^/]\.ph(p\d*|tml)$ {
    try_files /does_not_exists @php;
  }
}
location @php {
  ...
}

But, judging by the logs, they are all processed aslocation @php

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-09-08
@uralmas

location = /sources/skin.php {
    ...
}

location / {
    location ~ ^/forum/index\.php$ {
        ...
    }
    location ~ ^/forum/(admin|css|sitemap)\.php$ {
        ...
    }

    location ~ [^/]\.ph(p\d*|tml)$ {
        try_files /does_not_exists @php;
    }
}
location @php {
    ...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question