location ^~ /files/ {
if (!-e $request_filename){
return 301 http://images.site.ru$uri;
}
}
location ^~ /files/ {
try_files $uri =404;
error_page 404 =301 http://images.site.ru$uri;
}
location ~ /(wp-login|admin)\.php {
set $humantest 0;
if ($http_cookie !~* "humans=checktest") {
set $humantest 1;
}
if ($args ~* (callback|logout|lostpassword)) {
set $humantest 0;
}
if ($humantest = 1) {
add_header Content-Type text/html;
return 200 "<html><body><script>document.cookie='humans=checktest;path=/';location.reload();</script></body></html>";
}
error_page 404 = @fallback;
include fastcgi_params;
fastcgi_pass ...
}
location ~ \.php
server {
listen 80;
server_name xxx.ru;
root /var/www/html/vfm;
index index.php;
location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_pass fastcgi_backend_71;
}
location ^~ /hite {
root /var/www/html;
location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_pass fastcgi_backend_71;
}
}
}
rewrite ^/(?:(.*)/|)index\.(?:php|htm) /$1 permanent;
rewrite ^/(.*)\.(php|htm) /$1 permanent;
rewrite ^/(.*)/$ /$1 permanent;
rewrite ^/page/([^/]*)$ /page.php?param=$1;
rewrite ^/$ /index.php;
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location / {
try_files $uri @extensionless-php;
}
location @extensionless-php {
try_files $uri.php $uri/index.php =404;
include fastcgi.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
error_page 404 /error;
location /wp {
root /var/www/mysite;
try_files $uri /wp/index.php?args;
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
}
}
map $args $_at {
default "@";
"" "";
}
server {
location ~ ^(.+)\.html$ {
return 301 $1$is_args$args;
}
location / {
try_files $uri $uri$_at$args.html $uri/ /index.php?$args;
}
rewrite ^/MeDia/backups $uri_lowercase redirect;
rewrite ^/(?=(?i)media/backups)(?=.*?[A-Z]) $uri_lowercase redirect;
location ~ \.(css|jpe?g|png)$ {
try_files $uri @b;
}
location @b {
proxy_pass https://1.1.1.1;
proxy_set_header Host site.ru;
proxy_ssl_name site.ru;
}
geo $a {
default 0;
192.168.1.0/24 1;
10.1.0.0/16 1;
}
map $a$request_uri $b {
default 0;
~^1/mddd/service/test/exec-post\?f=modules\.testmodules 1;
}
server {
if ($b) {
return 403;
}
Какой из каталогов будет использоваться для временных файлов определяется параметром use_temp_path (1.7.10). Если параметр не задан или установлен в значение “on”, то будет использоваться каталог, задаваемый директивой proxy_temp_path для данного location. Если параметр установлен в значение “off”, то временные файлы будут располагаться непосредственно в каталоге кэша.
location /privacy-policies/ {
alias /home/user/privacy_policies/;
}
location / { location ~ [^/]\.ph(p\d*|tml)$ { try_files /does_not_exists @php; } }
location / {
try_files $uri $uri/ /index.php?$query_string;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
}
}
server { listen 80; listen [::]:80; server_name www.*; return 301 $scheme://$host$request_uri; }
server {
listen 80;
listen [::]:80;
server_name ~^www\.(?<domain>.+)$;
return 301 $scheme://$domain$request_uri;
}
map $host $domain {
~^www\.(.+) $1;
}
server {
listen 80;
listen [::]:80;
server_name www.*;
return 301 $scheme://$domain$request_uri;
}