Zend Framework on nginx

前端 未结 8 1262
小蘑菇
小蘑菇 2021-01-30 09:51

The Zend Framework based site I have been working on is now being migrated to its production server. This server turns out to be nginx (surprise!). Naturally the site does not w

8条回答
  •  走了就别回头了
    2021-01-30 10:20

    If you use a subdirectory for your project like http://some.url/myproject/controller/, then you also need to add setBaseUrl to your bootstrap file.

    bootstrap('frontController');
            $frontController = Zend_Controller_Front::getInstance();
            $frontController->setBaseUrl('/myproject'); // set the base url!
        }
    }
    

    The nginx rewrite would look like this:

    location /myproject/ {
      if (!-e $request_filename) {
        rewrite ^/myproject/(.*)$ /index.php?$1? last;
      }
    }
    

    PS The question mark is not typo!

提交回复
热议问题