Files Module got error 404...

oimken - 10 months ago

I migrate my local pyro to web. After a little hard works it seems works. but files module got error404 now.

Here is what I done:

  • 1.I got all database records of files module imported
  • 2.All file was uploaded and thepublic/apppermission is 777.
  • 3.Nginx conf has try_files $uri $uri/ /index.php?$query_string;
  • 4.I can see my folders and files(image) previews in backend.

Problems:

    1. Upload file shows me 404.
  • 2.Can NOT visit the original files through http://domain/files/folder/filename.jpg

What I try to find what's going on:

Add dd($public) in https://github.com/anomalylabs/files-module/blob/master/src/Http/Controller/FilesController.php#L37 It shows []

what should I do now, I do not know what's going on here, Help me please.

many many thanks!

ryanthompson - 10 months ago

Your server should try the application before looking for the files

oimken - 10 months ago

Thank you!!! I change my nginx rewite rule to this:

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

    location ~ \.php$ {
        try_files $uri @missing;

        fastcgi_pass localhost:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /path/to/nginx/conf/fastcgi_params;
    }

    location @missing {
        rewrite ^ /error/404 break;

        fastcgi_pass localhost:9000;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        include /path/to/nginx/conf/fastcgi_params;
    }

every is ok now!!!