I can't preview JPG image in browser

webserver_issue

#1

My English is not good,So please keep patient.
Thx, XD.

Steps to reproduce
Just installed the owncloud..

Expected behaviour
The thumbnail should show in the browser and I can preview the pic

Actual behaviour
I just can see the default pic,Black and white.
And owncloud told me " Could not generate a preview of this file.".
And the console print "500Error".

Server configuration
Operating system:CentOS 7
Web server:Nginx 1.10.3
Database:Mysql
PHP version:7.0.17
ownCloud version (see ownCloud admin page):9.1.4
Updated from an older ownCloud or fresh install:New
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption):Used the Nginx. Not more.

ownCloud log (data/owncloud.log)
no log...Not to print it.

Nginx.conf

user  www;
worker_processes  4;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

keepalive_timeout  60;

#gzip  on;

upstream php-handler {
    server 127.0.0.1:9000;
    #server unix:/var/run/php5-fpm.sock;
}

server{
    listen       80;
    server_name  localhost i.hurryhuang.cn hurryhuang.cn www.hurryhuang.cn;
    rewrite ^/(.*)$ http://hurryhuang.cn:88/$1 permanent;
}

server {
    listen       88;
    server_name  localhost i.hurryhuang.cn hurryhuang.cn www.hurryhuang.cn;
    root	     /home/www/hurry;

    charset UTF-8;

    #access_log  logs/host.access.log  main;

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        index  index.html index.htm;
    }

    location = /.well-known/carddav {
        return 301 $scheme://$host/owncloud/remote.php/dav;
    }

    location /.well-known/acme-challenge { }

    location ^~ /owncloud {
        #keepalive_timeout 6600;
        fastcgi_read_timeout 1200;
        fastcgi_request_buffering off;
        client_max_body_size 30G;
        client_body_temp_path /tmp;
        fastcgi_buffers 64 4K;
        gzip off;

        error_page 403 /owncloud/core/templates/403.php;
        error_page 404 /owncloud/core/templates/404.php;

        location /owncloud {
            rewrite ^ /owncloud/index.php$uri;
        }

        location ~ ^/owncloud/(?:build|tests|config|lib|3rdparty|templates|data)/ {
            return 404;
        }
        location ~ ^/owncloud/(?:\.|autotest|occ|issue|indie|db_|console) {
            return 404;
        }

        location ~ ^/owncloud/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            #fastcgi_param HTTPS on;
            #fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
            fastcgi_param front_controller_active true;
            fastcgi_pass php-handler;
            fastcgi_intercept_errors on;
            fastcgi_request_buffering off; #Available since nginx 1.7.11
        }

        location ~ ^/owncloud/(?:updater|ocs-provider)(?:$|/) {
            try_files $uri $uri/ =404;
            index index.php;
        }

        # Adding the cache control header for js and css files
        # Make sure it is BELOW the PHP block
        location ~* \.(?:css|js)$ {
            try_files $uri /owncloud/index.php$uri$is_args$args;
            add_header Cache-Control "public, max-age=7200";
            # Optional: Don't log access to assets
            access_log off;
        }

        location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
            try_files $uri /owncloud/index.php$uri$is_args$args;
            # Optional: Don't log access to other assets
            access_log off;
        }
    }

    location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){ 
		deny all; 
    } 

    error_page  404              /404.html;


    error_page   500 502 503 504  /50x.html;
    
    location ~ \.php(?:$|/) {
    fastcgi_param PATH_INFO $fastcgi_path_info; 
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
  	    include        fastcgi_params;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    
    location ~ /\.ht {
        deny  all;
    }
}
}

www.conf

pm.process_idle_timeout = 60s;
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
php_flag[display_errors] = off
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 256M

The owncloud config.php

  'logtimezone' => 'Asia/Shanghai',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'logdateformat' => 'Y-F-d H:i:s',
  'enable_previews' => true,
  'preview_max_x' => 3048,
  'preview_max_y' => 3048,
  'preview_max_scale_factor' => 10,
  'preview_max_filesize_image' => 60,

#2

A 500 error means "internal server errors" [1] and those are definitely logged somewhere in your logfiles. To be able to help here the matching error from your logfile needs to be provided.

[1]


#3

I will to do this to looking for error.But I'm sure the log of owncloud not to record this error,I maybe can check other‘s log to fix this.


#4

Normally, it must be in your webserver logfiles.