2017-08-16 1 views
0

Ich benutze Symfony 3.2 mit LiipImagineBundle 1.8.0 und Nginx mit php7 fpm in der Produktion. In Desenv ist der Webserver der eingebaute php-Server. In Desenv funktioniert gut und Cache-Verzeichnis werden im Web-Ordner erstellt, aber in der Produktion nicht und Symfony 404 für Bilder zurückgeben. Irgendeine Idee was das sein könnte? Dies ist meine Konfiguration:Symfony 3.2 mit LiipImagineBundle Ordnerordner nicht erstellen/Cache

Nginx

location/{ 
    try_files $uri @rewriteapp; 
} 

location @rewriteapp { 
    rewrite ^(.*)$ /app.php/$1 last; 
} 

location ~ ^/app\.php(/|$) { 

    include snippets/fastcgi-php.conf; 
    fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
    fastcgi_split_path_info ^(.+\.php)(/.*)$; 
    include fastcgi_params; 
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; 
    fastcgi_param DOCUMENT_ROOT $realpath_root; 
    internal; 
} 

location ~ \.(png|jpeg|jpg|gif)$ { 
    if (-f $request_filename) { 
     expires 18h; 
     add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 
     access_log off; 
    } 

    try_files $uri @rewriteapp; 
} 

Symfony Config

liip_imagine: 
    resolvers: 
     default: 
      web_path: 
       web_root: "%kernel.root_dir%/../web" 
       cache_prefix: "media/cache" 


    filter_sets: 
     cache: ~ 

     slide: 
      quality: 80 
      filters: 
       thumbnail: { size: [364, 244]} 
       watermark: 
        image: Resources/data/logo.png 
        size: 0.2 
        position: bottomleft 

Symfony Routing

_liip_imagine: 
    resource: "@LiipImagineBundle/Resources/config/routing.xml" 

Zweig Filter Verwendung

<img src="{{ asset('bundles/app/uploads/' ~ image.id ~ '/' ~ image.file) | imagine_filter('slide') }}" /> 

Berechtigungen in Medienordner von mir erstellt.

drwxrwxrwx+ 3 root  root 4096 Aug 15 19:05 media 
+0

Was von OS mit (Ubuntu ...)? –

+0

@ImanaliMamadiev Ja, Ubuntu 16.04 in Digital Ocean vm. –

+0

asset ('bundles/app/uploads /' ~ image.id ~ '/' ~ image.file) | imagine_filter ('slide') wie sieht es in html aus? –

Antwort

0

Ich habe das Problem gefunden.

In Config den korrekten Wert von cache_prefix muss contais traling slashe

liip_imagine: 
    resolvers: 
     default: 
      web_path: 
       web_root: "%kernel.root_dir%/../web" 
       cache_prefix: "/media/cache" 
Verwandte Themen