location ^~ /upload {
location ~ \.(png|jpe?g|gif)$ {
}
return 403;
}
location ^~ /source {
location ~ \.(js|css)$ {
}
return 403;
}
location ~* \.(jpe?g|gif|png|svg)$ {
if ($arg_moderation = "on") {
rewrite ^ /upload/system/no-avatar.jpg break;
}
}
location /comment-subscriptions/ {
add_header X-Robots-Tag "noindex, nofollow" always;
}
location ~ \.php$ {
if ($arg_srsrc = "f") {
add_header X-Robots-Tag "noindex, nofollow" always;
}
location = / {
root /usr/share/nginx/html;
rewrite ^ /index.html break;
}
location = /api/servertime {
access_log off;
rewrite ^ /index.php break;
include fastcgi.conf;
fastcgi_pass php;
}
location ~ \.php$
location ~ \.php$ {
if ($request_uri ~ "^/api/servertime") {
access_log off;
}
include fastcgi.conf;
fastcgi_pass php;
}
access_log путь [формат [if=условие]];
map $request_uri $loggable {
default 1;
~^/api/servertime 0;
}
server {
# ...
root /var/www/lumen/public;
try_files $uri $uri/ /index.php$is_args$args;
# ...
location ~ \.php$ {
access_log /var/log/nginx/access.log combined if=$loggable;
include fastcgi.conf;
fastcgi_pass php;
}
}
location ~ ^/c/(?!index\.php|d\.php|t\.js|app/project/_resource/s/|app/project/[^/]+/js/c\.min\.js) {
return 403;
}
location ^~ /c/ {
return 403;
location ~ ^/c/(index|d)\.php {
fastcgi_pass ...;
include fastcgi_params;
}
location = /c/t.js { }
location /c/app/project/_resource/s/ { }
location ~ ^/c/app/project/[^/]+/js/c\.min\.js { }
}
server {
...
root /home/site/public_html;
rewrite ^/(ru|en)?/?(faq|news|page|catalogue|basket|photos|search|users)(.*)$ /index.php?lang=$1&module=$2&mod_rewrite=$3;
rewrite ^/$ /index.php;
location / { }
location ~ \.php$ {
fastcgi_pass unix:/tmp/php-fpm7.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|woff|ogg|mpe?g|avi|zip|gz|rar)$ {
add_header Pragma public;
add_header Cache-Control "public";
access_log /home/site/cache.log;
expires 1d;
}
}
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;
}