Separate location for files served by php-fpm

Francis Daly francis at daoine.org
Tue May 16 00:15:42 UTC 2023


On Mon, May 15, 2023 at 12:46:14PM -1000, Palvelin Postmaster via nginx wrote:
> > On 8. May 2023, at 8.49, Palvelin Postmaster via nginx <nginx at nginx.org> wrote:

Hi there,

> > I use php-fpm together with nginx.
> > 
> > My PHP app serves files which have hashed filenames and no filename extension from a specific subdirectory url, e.g /files/hash/31b4ba4a0dc6536201c25e92fe464f85
> > 
> > I would like to be able to set, for example, a separate ’expires’ value to these files with nginx (using a separate location block?). Is that achiavable?

In principle, yes. So long as the requests use different urls (excluding
query string).

In practice: from the words here, it is not entirely clear to me what
your overall application is doing.

Maybe you can have a location{} dedicated to these file-requests; or maybe
it would be "cleaner" for the php side to add the extra Expires header.

Can you show one or two sample requests that are made to nginx that you
do want to have this extra Expires header; and one or two that you do
not want to have this extra Expires header?

The aim is to come up with a location{} block that matches only the
requests that you want, if that is possible.

Thanks,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list