Passing a special Magento URL to PHP-FPM

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Passing a special Magento URL to PHP-FPM

vergil
I’m trying to learn how to pass special 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 I wonder if this even worksfor the above-mentioned
URL?


   location @handler { ## Magento uses a common front handler
       rewrite / /index.php;
   }

   location ~ \.php/ { ## Forward paths like /js/index.php/x.js to relevant
handler
       rewrite ^(.*\.php)/ $1 last;
   }

   location ~ \.php$ {
       fastcgi_pass   fpm_backend;
       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       include        fastcgi_params; ## See /etc/nginx/fastcgi_params
   }

   location / {
       index index.html index.php; ## Allow a static html file to be shown
first
           try_files $uri $uri/ @handler; ## If missing pass the URI to
Magento's front handler
           expires 30d; ## Assume all files are cachable
           if ($request_uri ~*
"\.(png|gif|jpg|jpeg|css|js|swf|ico|txt|xml|bmp|pdf|doc|docx|ppt|pptx|zip)$")
{
               expires max;
           }

       # set fastcgi settings, not allowed in the "if" block
       include /usr/local/etc/nginx/fastcgi_params;
       fastcgi_split_path_info ^(.+\.php)(/.+)$; #this line
       fastcgi_param SCRIPT_FILENAME $document_root/index.php;
       fastcgi_param SCRIPT_NAME /index.php;
       fastcgi_param  MAGE_RUN_CODE default;
       fastcgi_param  MAGE_RUN_TYPE store;

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

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,288062,288062#msg-288062

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Passing a special Magento URL to PHP-FPM

Francis Daly
On Sat, May 16, 2020 at 06:29:01PM -0400, hgv wrote:

Hi there,

> I’m trying to learn how to pass special Magento 1.x URLs such as this to a
> PHP-FPM backend.

https://forum.nginx.org/read.php?2,288050, plus the response at
https://forum.nginx.org/read.php?2,288050,288051, perhaps?

Cheers,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx