fastcgi_buffering off;
header('X-Accel-Buffering: no');
map $http_host $domain_lang {
~(?i)^(?>www\.|)([a-z]+)\.site\.ru$ $1;
}
server {
location @php {
fastcgi_param DOMAIN_LANG $domain_lang;
В качестве ключа можно использовать текст, переменные и их комбинации. Запросы с пустым значением ключа не учитываются.
limit_req_zone $key zone=bot:10m rate=1r/s;
$key_
которая будет возвращать пустую строку в качестве ключа для limit_req_zone если в $args что-то есть.map $args $key_ {
"" $key;
default "";
}
limit_req_zone $key_ zone=bot:10m rate=1r/s;
server {
listen 127.0.0.1:80;
server_name localhost;
root /home/localhost/public_html/public;
index index.php;
log_not_found off;
access_log logs/localhost-access.log main;
charset utf-8;
location / {
try_files $uri $uri/ @php;
}
location @php {
rewrite ^/(.*) /index.php?url=$1;
}
location ~ /\. { deny all; }
location = /favicon.ico { }
location = /robots.txt { }
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9071;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Директивы наследуются с предыдущего уровня при условии, что на данном уровне не описаны свои директивы add_header.
add_header Strict-Transport-Security
, так что директивы с предыдущего уровня не наследуются. server {
listen 80;
server_name subdomain.domain.com;
location / {
proxy_pass http://domain.com/subdomain/;
}
}
if ($request_uri ~ "/redir\?domain=mybot&start=\d+") {
return 301 tg://resolve?$args;
}
server {
listen 123.123.123.123:80 default_server;
server_name 123.com www.123.com;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
charset off;
index index.php index.html;
set $root_path /var/www/www-root/data/www/123.com/public;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
access_log /var/www/httpd-logs/123.com.access.log;
error_log /var/www/httpd-logs/123.com.error.log notice;
error_page 404 /index.php;
location / {
return 301 https://$host$request_uri;
}
location ~ ^/(bouns)?$ {
fastcgi_param SCRIPT_FILENAME $root_path/index.php;
fastcgi_pass unix:/var/www/php-fpm/www-root.sock;
include fastcgi_params;
}
}
location / {
resolver 8.8.8.8;
proxy_pass http://$arg_url;
add_header Access-Control-Allow-Origin *;
}