Separate location for files served by php-fpm

Francis Daly francis at daoine.org
Wed May 24 17:25:35 UTC 2023


On Thu, May 18, 2023 at 09:14:42PM -0700, Palvelin Postmaster via nginx wrote:

Hi there,

> My goal is to serve only requests which include URI /files/hash/*
> using a separate location block. Everything else should be served by
> the default location block I included in my previous message.

Untested, but would

	location ^~ /files/hash/ {
		fastcgi_pass php74;
		fastcgi_param SCRIPT_FILENAME /var/your-php-script.php;
		expires 10d;
	}

meet what your goal is?

Adjust the fastcgi_param value to whatever your fastcgi server needs.

The important part is probably the "location" line that matches
all-and-only these requests.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list