Passing a special Magento URL to PHP-FPM

Francis Daly francis at daoine.org
Fri May 15 17:11:18 UTC 2020


On Fri, May 15, 2020 at 09:49:38AM -0700, Palvelin Postmaster wrote:

Hi there,

> I’m trying to learn how to pass specific Magento 1.x URLs such as this to a PHP-FPM backend.
> 
> /js/index.php/x.js?f=prototype/prototype.js,prototype/validation.js,mage/adminhtml/events.js,mage/adminhtml/form.js,scriptaculous/effects.js

> All the nginx configs I’ve found (e.g. https://gist.github.com/rafaelstz/3bc3343017dd0118a577) include the same configuration blocks but does it actually work for the above mentioned URL structure?
> 

Are you asking whether you should try it; or are you reporting that
something does not respond as you want it to, when you do try it?

Your request, as far as choosing the location{} is concerned, is
/js/index.php/x.js

If your config is only what you show here, that will be handled in your
"location ~ \.php/" block, and it should all Just Work.

But the "e.g." link you show includes "location ~ \.js {", and *that* is
the location that will handle this request if you use that full config.
So it won't use fastcgi_pass at all.

Remove that stanza, or put it after the "\.php/" one.

Without testing it, I would expect that this part will probably work...

>     location ~ \.php$ { ## Execute PHP scripts
>         expires        off; ## Do not cache dynamic content
>  
>         fastcgi_pass   fpm_backend;
>         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
>         include        fastcgi_params; ## See /etc/nginx/fastcgi_params
>     }

...but I'm not sure about this next part:

>         # rewrite - if file not found, pass it to the backend
>         if (!-f $request_filename) {
>             fastcgi_pass fpm_backend;
>             break;
>         }
>     }

Maybe does not matter here; presumably the person who published the
config believes it is necessary.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list