Если у совпавшего префиксного location’а максимальной длины указан модификатор “^~”, то регулярные выражения не проверяются.
location /site2/
добавить ^~
location /site1 {
добавить location ~* \.php$
location /site1 {
root /var/www/site1;
location ~* \.php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; # подключаем сокет php-fpm
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
location ^~ /site2/ {
proxy_pass https://site2/;
}
RewriteCond %{DOCUMENT_ROOT}/files/$1 -f
RewriteRule ^(img/.+) /files/$1 [L]
server_name domain.ru;
location /api/ {
root /var/www/site.ru;
rewrite ^ /index.php break;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
server {
client_max_body_size 32M;
location /faq/upload {
client_max_body_size 400M;
try_files $uri @admin_upload;
}
location @admin_upload {
rewrite ^ /index.php break;
fastcgi_pass ... ;
include fastcgi_params;
}
location ~ \.php$ {
fastcgi_pass ... ;
include fastcgi_params;
}
server
{
...
location ~* ^/build/.*\.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
log_not_found off;
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
log_not_found off;
}
}
RewriteRule ^(.+?)\.html(?!/amp/).+$ https://%{HTTP_HOST}/$1.html? [L,R=301]
RewriteCond %{QUERY_STRING} !^$
RewriteCond %{QUERY_STRING} !(^|&)srp=
RewriteCond %{QUERY_STRING} !(^|&)srk=
RewriteRule ^(.+?)\.html$ https://%{HTTP_HOST}/$1.html? [L,R=301]
RewriteCond %{REQUEST_URI} !^/wp-content/cache/
RewriteRule ^(.+?)\.html(?!/amp/).+$ https://%{HTTP_HOST}/$1.html? [L,R=301]
RewriteEngine On
RewriteRule ^old/(\d+)$ https://site.ru/new/$1 [R=301,L]
map $arg_arg1 $conf {
default "conf.js";
"4982948394" "conf2.js";
}
server {
location = /conf.js {
alias /config/$conf;
}
$text = 'клиент: краеугольный менеджер: желтый цвет';
$pattern = '/(клиент|менеджер):\h*(.*?)\h*(?=$|клиент:|менеджер:)/';
preg_match_all($pattern, $text, $matches);
$result = array_combine($matches[1], $matches[2]);
var_dump($result);
Modifiers
Particular items can be restricted to print only for responses with specific HTTP status codes by placing a comma-separated list of status codes immediately following the "%". The status code list may be preceded by a "!" to indicate negation.
%!
перечислить через запятую коды ответов которые нужно исключить.CustomLog "logs/access_log" combined "expr=!%{REQUEST_STATUS} -in {'200', '301','302'}"
RewriteCond %{REQUEST_URI} ^/shop/shop/(.*)$
RewriteRule ^(.*)$ /shop/%1 [R=301,L]
RewriteRule ^shop(/shop/.*) $1 [R=301,L]