php – Nginx: How to serve static files for a special user
i have a page where the user has static files (pdf) and images (created from the pdf on)
there is a structure like
/files/user1/img/foo.jpg
/files/user1/pdf/foo.pdf
/files/user2/img/bar.jpg
/files/user2/pdf/bar.pdf
...
At the moment i deliver these images and pdf files with a php script which checks if user1 is authenticated (with something like php?img=user1.jpg) but this is slow.
I want do serve it directly with nginx but it needs some sort of authentification to insure that only the logged in user1 can read files from user1 etc.
There is a PHP login done with codeigniter4, is there a way to let nginx at the login with php know that is allowed to server the files to user1?
Thanks for helping.
Best regards
Alex
Read more here: Source link