Note that there are some explanatory texts on larger screens.

plurals
  1. PONginx + Php-fpm + Zend Framework 1.11 strange rewrite error
    primarykey
    data
    text
    <p>I have strange rewrite problem with nginx &amp; php5-fpm on an *nix platform. I'm using a Router.php class as app resource and there are lot of routes in this file which generates user-friendly uri's for corresponding modules &amp; controllers. Now, i want to move some of this regex based application routes to nginx level and when i move a route to nginx config, i'm getting "invalid controller specified" error.</p> <p>Simply, when a user requests a /foo URI, i want to trigger BarController's bazAction(). It's successfully working on application level (via Router resource)</p> <pre><code>public function init() { $router = Zend_Controller_Front::getInstance()-&gt;getRouter(); $f = new Zend_Controller_Router_Route_Static('foo', array( 'controller' =&gt; 'Bar', 'action' =&gt; 'baz')); $router-&gt;addRoute( 'foo', $f); ... </code></pre> <p>When i try to do this using nginx rewrite rules like this</p> <pre><code>rewrite ^/foo /index.php/bar/baz?$args last; </code></pre> <p>I'm getting Invalid controller specified (foo) error. How can i handle this rewrite rules correctly?</p> <p>My server.config is:</p> <pre><code> server { listen 80; server_name www.dummy.com; root /Users/foozy/Sites/dummy.com/public; index index.php; location / { try_files $uri $uri/ @rewrites; } location @rewrites { rewrite ^/foo /index.php/bar/baz?$args last; # i also tried : # rewrite ^/foo /bar/baz?$args last; rewrite ^ /index.php?$args; } location ~ ^.+\.php { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; } } </code></pre> <p>My fastcgi_params file is:</p> <pre><code>fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; ... nginx's default params here ... fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; ... fastcgi_param APPLICATION_ENV development; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; </code></pre> <p>And in php.ini fix_pathinfo is set to 0:</p> <pre><code>cgi.fix_pathinfo=0 </code></pre> <p>PHP v5.3.8, Nginx v1.0.10</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload