Forum: NGINX Rewrite for Zend Framework

Posted by Huan Truong (Guest)
on 2007-11-07 07:39
(Received via mailing list)
Hi all,

I hav difficulties creating rewrite rules for
Zend_Controller_Router_Rewrite according to
http://framework.zend.com/manual/en/zend.controller.router.html

The apache rewrite rule was:
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

But when I ported this to nginx:

location / {
root /home/my_home/public_html;
if ($request_filename !~ "\.(js|ico|gif|jpg|png|css)$") {
  rewrite ^(.*) index.php last;
}
index index.php;
}

It didn't work. I always received this error message when requesting an
url (http://my-site.com/test/) from nginx: No input file specified.

Please help. Thanks in advance.
Posted by Igor Sysoev (Guest)
on 2007-11-07 07:47
(Received via mailing list)
On Wed, Nov 07, 2007 at 01:29:36PM +0700, Huan Truong wrote:

> But when I ported this to nginx:
> url (http://my-site.com/test/) from nginx: No input file specified.
> 
> Please help. Thanks in advance.

      location  /   {
          fastcgi_pass   ...
          fastcgi_param  SCRIPT_FILENAME 
/home/www/scripts/php/index.php;
          ...
      }

      location ~ \.(js|ico|gif|jpg|png|css)$") {
          root /home/my_home/public_html;
          ...
      }
Posted by Igor Sysoev (Guest)
on 2007-11-07 07:52
(Received via mailing list)
On Wed, Nov 07, 2007 at 09:39:50AM +0300, Igor Sysoev wrote:

> > RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
> > 
> 
>       location ~ \.(js|ico|gif|jpg|png|css)$") {

-       location ~ \.(js|ico|gif|jpg|png|css)$") {
+       location ~ "\.(js|ico|gif|jpg|png|css)$") {
Posted by Huan Truong (Guest)
on 2007-11-07 08:16
(Received via mailing list)
Igor, it worked perfectly.

Thank you!

- Huan.

PS: Btw,... ;-)

Igor Sysoev wrote:
> On Wed, Nov 07, 2007 at 09:39:50AM +0300, Igor Sysoev wrote:
> 
>> On Wed, Nov 07, 2007 at 01:29:36PM +0700, Huan Truong wrote:
>>
>>       location ~ \.(js|ico|gif|jpg|png|css)$") {
> 
> -       location ~ \.(js|ico|gif|jpg|png|css)$") {
> +       location ~ "\.(js|ico|gif|jpg|png|css)$") {
> 
-       location ~ "\.(js|ico|gif|jpg|png|css)$") {
+       location ~ "\.(js|ico|gif|jpg|png|css)$" {
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.