Good day!
The question is, in fact, in the following:
There are two sites on the same domain. One is located in the root folder of the domain, and the second in a virtual subfolder. Nginx config
server { listen 443 ssl http2; server_name www.example.ru; root /var/www/example; index index.php; location / { root /var/www/example; index index.php index.html index.htm; rewrite ^/api/(.*)$ /api.php?_d=$1&ajax_custom=1&$args last; try_files $uri $uri/ @fallback; location /catalog { root /var/www/example; index index.php index.html index.htm; try_files $uri $uri/ @fallback; } } As a result, both sites open at example.ru and example.ru/catalog
But!
example.ru/catalog is looking for pictures, js files, etc. in the / var / www / example / catalog directory, which does not exist. All its files are a higher level (/ var / www / example /). How to make the subdirectory look at the level above so that it sees all the necessary files?
Thank!
Upd:
It turned out to solve part of the problem by adding below
location ~ ^/catalog/(.+\.(?:gif|jpe?g|png|js|css|svg|ttf))$ { alias /var/www/example/$1; } After that, the necessary files became visible.
There is a problem with the arguments going after index.php
Example: https://example.ru/catalog/index.php?dispatch=ab__grid_tabs.load&block_id=298&result_ids=content_ab__grid_tab_2379_298&is_ajax=1
Gives 404 to the console. Because of this, part of the functionality and content of the site https://example.ru/catalog disappears.
The index.php file itself is physically located here: https://example.ru/index.php
Is it possible to solve such a problem through the nginx configuration?