0

I'm using this docker image: webdevops/php-nginx:latest

I try to access an image with the url: http://localhost/cache/gen/image/w4I1QDE94564ZiI6IjJESXRl55MvQ3VycmVDE3kvU2VudGluZWw4SmV3ZWxsZXJBUmVjb21iaW5hdG9yI456c2NhbGUiOjF9XQ/qqb3204ec5/Model.png but it points to my index.php

I tried putting the image in the root folder (/app/public/) and that just works fine.

For me it does seam like the url is to long?

I tripple checked that the file is in that location (/app/public/cache/gen/image/..). It is..

How can I access the PNG file with this url?

(If possible I don't want to change the folder structure, because it is from a data dump)

I attached the config file:

server {
    listen 80 default_server;

    server_name  _ *.vm docker;

    root "/app/public/";
    index index.php;

    client_max_body_size 50m;

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

    access_log   /docker.stdout;
    error_log    /docker.stderr warn;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME     $request_filename;
        fastcgi_read_timeout 600;
    }
}
BlooAtro
  • 1
  • 2
  • What is the content of nginx access and error log for that request? – Tero Kilkanen Aug 12 '22 at 20:37
  • Thank you, haven't thought about checking the logs.. well after some digging I found the anwser: Permissions. Will edit my Question with the solution and why it happend.. – BlooAtro Aug 12 '22 at 22:57

1 Answers1

0

It was a permission problem. Checked the logs found this line:

2022/08/12 22:44:48 [crit] 67#67: *664 stat() "/app/public/cache/gen/image/w4I1QDE94564ZiI6IjJESXRl55MvQ3VycmVDE3kvU2VudGluZWw4SmV3ZWxsZXJBUmVjb21iaW5hdG9yI456c2NhbGUiOjF9XQ/qqb3204ec5/Model.png" failed (13: Permission denied), client: 172.18.0.2, server: _, request: "GET /cache/gen/image/w4I1QDE94564ZiI6IjJESXRl55MvQ3VycmVDE3kvU2VudGluZWw4SmV3ZWxsZXJBUmVjb21iaW5hdG9yI456c2NhbGUiOjF9XQ/qqb3204ec5/Model.png HTTP/1.1"

Crucial part here is: failed (13: Permission denied) which means www-data couldn't read the files, because they were created by an other user, but I didn't notice..

Folder was on 0751, so www-data couldn't read the files, solution was setting permission to 755

chmod -R 755 /app/

Serverfault anwser that did it for me

BlooAtro
  • 1
  • 2