Nginx Konfiguration fürs Zend Framework mit php-fpm
Es gibt diverse Gründe von Apache als Webserver auf Ngninx umzusteigen, auf die ich hier allerdings erst mal nicht weiter eingehen möchte. Die Performence ist wohl der erste davon. Damit eine Zend Framework Applikation richtig auf dem Nginx läuft, muss die Konfigurationsdatei für den Vhost entsprechend angepasst sein, da es keine .htaccess Datei mehr gibt, die für die Rewrite Regeln zuständig ist.
Hier also mal ein Beispiel für eine funktionierende, einfache Konfigurationsdatei für Nginx und einer Zend Framework Applikation mit php-fpm.
server { # -- main vhost config listen 80; server_name www.yourdomain.tld; root /path/to/public; # -- logging access_log /var/log/nginx/access.log main; error_log /var/log/nginx/error.log notice; # -- default index file index index.php; # -- who can access it? allow all; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { # for use with php-fpm fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_param APPLICATION_ENV development; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; include conf.d/php.conf; } }
Zugriffe: 11404