Zend Framework on nginx

前端 未结 8 1343
小蘑菇
小蘑菇 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:32

    I know it's a pretty old thread but it might help some people anyway.

    Basically it redirects any 404 error to index.php, but if the file exists (type file) it will set the right root.

    I did it from the top of my head. It might not be working right away, and you have to put the right path and fastcgi config. I also put everything back to index.php as it should work like that with Zend_Framework

    error_page  404 = /index.php;
    
    location / {
        if (-f $request_filename) {
            root   /var/www;
        }
    }
    
    location ~ \.php$ {
            fastcgi_pass   unix:/tmp/php.sock;
            fastcgi_index  index.php;
    
            fastcgi_param  SCRIPT_FILENAME     /var/www/index.php;
            include /etc/nginx/fastcgi_params;
    }
    

提交回复
热议问题