Advertisement
Guest User

Untitled

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