D
D
Dmitry Lezhnev2015-09-21 12:13:22
PHP
Dmitry Lezhnev, 2015-09-21 12:13:22

Nginx / PHP - how to restrict access to static files (pictures, media) from PHP?

Is it possible to configure nginx to only serve static if the user has permission to do so? Permissions are defined in the business logic inside PHP scripts.
I understand that this can easily be done in such a way that all static files are served through PHP, but in this case there will be a greater load on server resources.
Is there an alternative?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mkdev, 2015-09-21
@dimalez

Most likely the X-Accel-Redirect header will help you: https://www.nginx.com/resources/wiki/start/topics/... .

V
Vlad Zhivotnev, 2015-09-21
@inkvizitor68sl

auth_request

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question