Mehic.info

How to spin the Zend Framework on nginx ?

Easy!

As you might know, on nginx there is no .htaccess file. So you must specify your routing in .vhost file. Here is an example of one zend page that is spining on nginx. Enjoy!

server {
        listen 111.222.333.444:80;
        server_name website.ba www.website.ba;
        root   /var/www/website.ba/web/public;
        index index.html index.htm index.php index.cgi index.pl index.xhtml;
        location ~ \.shtml$ {
            ssi on;
        }

        error_log /var/log/ispconfig/httpd/website.ba/error.log;
        access_log /var/log/ispconfig/httpd/website.ba/access.log combined;
        location / {
                # This is cool because no php is touched for static content
                try_files $uri $uri/ /index.php?$args;
         }

        location ~ \.php$ {
            #try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9022;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_intercept_errors on;
        }

        location /cgi-bin/ {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            root /var/www/clients/client1/web10;
            gzip off;
            fastcgi_pass  unix:/var/run/fcgiwrap.socket;
            fastcgi_index index.cgi;
            fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_intercept_errors on;
        }

}
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better.