2

I have nginx web-server and PHP business logic. I want to allow access static files (images, media) only for certain users.

The authentication rules are defined in PHP.

I understand that it is easily achievable via serving static files through PHP. But it will cost in low performance.

Is there an alternative approach?

Dmitriy Lezhnev
  • 801
  • 2
  • 10
  • 18

1 Answers1

0

Solved the task by using X-Sendfile feature. More here: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/

Dmitriy Lezhnev
  • 801
  • 2
  • 10
  • 18
  • can you explain what you did? can ngnix access database to check for user authenticity if say a token is given to the request – Syed Faizan Dec 22 '16 at 15:04