Директивы наследуются с предыдущего уровня при условии, что на данном уровне не описаны свои директивы 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 *;
}
RewriteCond %{CF-Connecting-IP} ^XXX.YY.* RewriteCond %{X-Real-IP} ^XXX.YY.*
RewriteCond %{HTTP:CF-Connecting-IP} !^XXX\.YY\.
RewriteCond %{HTTP:X-Real-IP} !^XXX\.YY\.
RewriteEngine On
RewriteCond %{HTTP:X-Real-IP} !^XXX\.YY\.
RewriteRule (.*) - [F]
server { server_name www.example.com; listen *:80; listen [::]:80 ipv6only=on; if ($uri !~* ^/downloads/(.+)$) { return 301 https://example.com/downloads/$1; } }
if
лучше использовать location.server {
server_name example.com www.example.com;
listen *:80;
listen [::]:80 ipv6only=on;
location / {
return 301 https://example.com$request_uri;
}
location /downloads/ {
root /var/www/html;
}
}
location ~ ^/i/imgs?/(.*)$ {
resolver 8.8.8.8;
proxy_pass https://$1;
}
location ~ ^/i/imgs?/img\.site2\.ru/(.*)$ {
proxy_pass https://img.site2.ru/$1;
}