Welcome! Log In Create A New Profile

Advanced

Zend Rewrite Problem

Posted by fotopano 
Zend Rewrite Problem
September 05, 2011 03:37AM
Helo!
I have problem with Nginx rewrite - just created vhost config file, and it works nearly good, except it doesn't rewrite to Zend some URLs:

Here is my vhost config:

server {
listen 80;
server_name fotopano.net en.fotopano.net;
root /var/www/fotopano.net/public_html;
access_log off;
error_log /var/log/nginx/fotopano.net/error.log;
index /index.php;

# remove trailing slash, that throws ZF router
rewrite ^/(.*)/$ /$1 break;

location /
{
try_files $uri $uri/ /index.php?$args;
}

location ~* \.php
{
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 600;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param APPLICATION_ENV production;
}

# expires headers on known filetypes
location ~* ^.+.(css|js|jpeg|jpg|gif|png|ico)
{
access_log off;
expires max;
}

}

When i try to open some urls, like this one:
http://fotopano.net/galeria/torun/rynek-nowomiejski
it doesn't go through Zend application. Here is a log message - from this what I see it look for a directory with a given parameter, but it's wrong:

2011/09/05 09:31:07 [error] 8062#0: *5 open() "/var/www/fotopano.net/public_html/galeria/torun/rynek-nowomiejski" failed (2: No such file or directory), client: 87.206.45.163, server: fotopano.net, request: "GET /galeria/torun/rynek-nowomiejski HTTP/1.1", host: "fotopano.net", referrer: "http://fotopano.net/galeria/torun,5"



Edited 1 time(s). Last edit at 09/05/2011 03:38AM by fotopano.
Re: Zend Rewrite Problem
September 12, 2011 09:10AM
Hi fotopano,

the solution is rather simple. instead of rewriting the request to the given script filenam you have to configute proxy_pass to redirect every request zu your Zend Framework main .php:
so, instead of
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
you write:
fastcgi_param SCRIPT_FILENAME $document_root/index.php;

Greetings,
Haimi
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 181
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready