Drupal 8 + nginx + php 7 Стиль изображения: не удалось создать файл или папку

Я запускаю Drupal 8.5.3 на Centos7 с Nginx + PHP7 + PHP 7 FPM После успешного запуска установки Drupal я хочу добавить статью, но изображение эскиза возвращает ошибку 404. Изображение загружается в папку sites / default / files, но папку стиля изображения создать нельзя. Мой статус drupal и Ошибка стиля изображения 404 после загрузки изображения для статьи

Это моя конфигурация nginx

server {
        listen 80;

        # access_log off;
        access_log /home/drupal8.mds.com.vn/logs/access.log;
        # error_log off;
        error_log /home/drupal8.mds.com.vn/logs/error.log;

        root /home/drupal8.mds.com.vn/public_html;
        index index.php index.html index.htm;
        server_name drupal8.mds.com.vn;

        # Custom configuration
        include /home/drupal8.mds.com.vn/public_html/*.conf;

        location / {
                #try_files $uri $uri/ /index.php?$args;
                try_files $uri /index.php?$query_string;
        }

        location ~ '\.php$|^/update.php' {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                #fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
                #fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_connect_timeout 300;
                fastcgi_send_timeout 300;
                fastcgi_read_timeout 300;
                fastcgi_buffer_size 32k;
                fastcgi_buffers 8 16k;
                fastcgi_busy_buffers_size 32k;
                fastcgi_temp_file_write_size 32k;
                fastcgi_intercept_errors on;
                fastcgi_param SCRIPT_FILENAME home/drupal8.mds.com.vn/public_html$fastcgi_script_name;
    }
        location ~ /\.(?!well-known).* {
                deny all;
                access_log off;
                log_not_found off;
        }

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }
       location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|is$
                gzip_static off;
                add_header Pragma public;
                add_header Cache-Control "public, must-revalidate, proxy-revalidate";
                access_log off;
                expires 30d;
                break;
        }

        location ~* \.(txt|js|css)$ {
                add_header Pragma public;
                add_header Cache-Control "public, must-revalidate, proxy-revalidate";
                access_log off;
                expires 30d;
                break;
        }

     location ~ \..*/.*\.php$ {
        return 403;
    }

    location ~ ^/sites/.*/private/ {
        return 403;
    }
    location ~* ^/.well-known/ {
        allow all;
    }

    location ~ (^|/)\. {
        return 403;
    }

    location @rewrite {
        rewrite ^/(.*)$ /index.php?q=$1;
    }

    location ~ /vendor/.*\.php$ {
        deny all;
        return 404;
    }
     location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7
        try_files $uri @rewrite;
    }

    location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7
        try_files $uri /index.php?$query_string;
    }
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        try_files $uri @rewrite;
        expires max;
        log_not_found off;
    }

}

Для drupal 7 у меня такая же проблема, но я могу взломать ядро ​​в модулях / образе function image_style_url ($ style_name, $ path) {

  //Create derivated image if not exist ductm add
  if(!file_exists($file_url) && !file_exists($uri)){
    if(file_exists($path)){
      $currentStyle = image_style_load($style_name);
      image_style_create_derivative($currentStyle, $path, $uri);
    }
  }

  return $file_url;

разрешение nginx user sites / default / files / styles

0
задан 20 May 2018 в 03:42
1 ответ

Насколько я знаю , чтобы решить эту проблему, вам следует проверить следующие параметры:

Прохождение | :

Проверьте папку и права доступа к подпапке, убедитесь, что папка для загрузки достаточно разрешений 0755.

Проверьте следующие каталоги, чтобы узнать больше о том, что происходит, когда вы достигаете 404 не найденной страницы в журналах:

/var/log/nginx/*

/var/logs/nginx/* 
0
ответ дан 24 November 2019 в 02:40

Теги

Похожие вопросы