Advertisement
Guest User

Untitled

a guest
Jan 13th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.28 KB | None | 0 0
  1. upstream php {
  2.     server unix:/var/run/php/php7.2-fpm.sock;
  3. }
  4.  
  5. server {
  6.     charset utf-8;
  7.     client_max_body_size 1M;
  8.  
  9.     listen 80;
  10.  
  11.     server_name domain.ru;
  12.     set         $root /var/www/domain;
  13.     root        $root/web/site/web/;
  14.     index       index.php;
  15.  
  16.     disable_symlinks off;
  17.  
  18.     access_log  /var/log/www/domain/site-access.log combined buffer=5M flush=5m;
  19.     error_log   /var/log/www/domain/site-error.log;
  20.  
  21.     if (-f $document_root/maintenance.html) {
  22.         return 503;
  23.     }
  24.  
  25.     location / {
  26.         try_files $uri $uri/ /index.php$is_args$args;
  27.     }
  28.  
  29.     location = /blank.gif {
  30.         empty_gif;
  31.     }
  32.  
  33.     location ~ ^/assets/.*\.php$ {
  34.         deny all;
  35.     }
  36.  
  37.     location ~ ^/fetch(.+)$ {
  38.          internal;
  39.  
  40.          fastcgi_pass php;
  41.  
  42.          fastcgi_store        on;
  43.          fastcgi_store_access user:rw group:rw all:r;
  44.          fastcgi_temp_path    /tmp 1 2;
  45.  
  46.          alias $root$1;
  47.     }
  48.  
  49.     location ~ ^/images/([avatar|building|block|offer|floor].+\.[jpg|jpeg|gif|png]+)$ {
  50.         expires 1y;
  51.         error_page 404 403 415 /blank.gif;
  52.  
  53.         valid_referers none blocked server_names ~\.domain\.ru ~\.google\. ~\.yandex\.;
  54.  
  55.         if ($invalid_referer) {
  56.             return 403;
  57.         }
  58.  
  59.         root $root;
  60.         #error_page 404 = /fetch$uri;
  61.         try_files $root$uri /fetch$uri;
  62.     }
  63.  
  64.     location ~ (.+)\.(css|js|svg)$ {
  65.         charset_types *;
  66.         expires 1y;
  67.         gzip_static on;
  68.  
  69.         try_files $1.min.$2 $1.$2 $uri;
  70.     }
  71.  
  72.     location ~ ^/sitemap.*\.xml$ {
  73.         expires modified 1d;
  74.     }
  75.  
  76.     location ~ \.php$ {
  77.         include fastcgi_params;
  78.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  79.         fastcgi_pass php;
  80.         try_files $uri =404;
  81.     }
  82.  
  83.     location ~* /\. {
  84.         deny all;
  85.     }
  86. }
  87.  
  88. =======
  89.  
  90. /var/www/domain/images # tree
  91. .
  92. ├── building
  93. │   └── 73
  94. │       └── 3a
  95. │           └── zhk-bauman-house-1200x404.jpeg
  96. └── original
  97.     └── 90
  98.         └── 36
  99.             └── 9036870d5f51611d3f61eaecb12948cb0d45e5a4
  100.  
  101. file /var/www/domain/images/building/73/3a/zhk-bauman-house-1200x404.jpeg
  102. /var/www/domain/images/building/73/3a/zhk-bauman-house-1200x404.jpeg: empty
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement