вы то как хотите, чтобы хитрый урл разбирался силами ZF уже ? если так, то вполне достаточно настроить nginx на примерно следующий алгоритм: "если есть локальный файл, отдаем его, иначе роутим на ZF" это нормальный подход для большинства CMS/CMF, народ же зачем-то упорно костылит штуки типа
if (!-e $request_filename) { rewrite ^.*$ /index.php last; } брр.... try_files рулит, в общем. есть подозрение, что документация по nginx сильно проседает в плане "как мне захостить drupal/joomla/ZF/symphony/Cake...." огромное количество соверешенно нелепых конфигов, по всему интернету. вот работающий конфиг для ZF: server { listen 80; server_name .xxx.ru; root /srv/www/xxx; charset utf-8; access_log /var/log/nginx/xxx_access.log long buffer=32k; location / { try_files $uri $uri/ @zend; index index.php index.html index.htm; add_header Cache-Control max-age=1209600; } location ~ \.php$ { try_files $uri @zend; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } location @zend { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/index.php; include fastcgi_params; } location ~ /\. { deny all; } } 3 августа 2013 г., 20:39 пользователь automatix <nginx-fo...@nginx.us> написал: > Доброго времени суток! > > Даблпостинг не есть гуд. Надеюсь на снисходительность админов/модераторов. > Тем более, что оригинал (http://forum.nginx.org/read.php?2,241421) на другом > языке. > > Дело в следующем. Есть сайт с каталогом городов. На странице каждого города > есть список линков на виды спорта. (Далее на странице каждого вида спорта > есть список курсов по данному виду спорта, предлагаемых в данном городе.) > Выглядит это так: > > page "Cities" (/catalog) > Madrid link: website.tld/catalog/Madrid > Berlin link: website.tld/catalog/Berlin > London link: website.tld/catalog/London > > page "Sports in London" (/catalog/London) > Foo link: website.tld/catalog/London/Foo > Bar (Bar) link: website.tld/catalog/London/Bar (Bar) > Baz - Baz link: website.tld/catalog/London/Baz - Baz > > Проблема в УРЛах со спецсимволами. Если они заэскейпены (например, > "website.tld/catalog/Berlin/Jeu%20de%20Paume%20%28Real%20Tennis%29"), все > работает. Если же нет -- то есть юзер сам вводит адрес (например, > "website.tld/catalog/Berlin/Jeu de Paume (Real Tennis)"), то сервер > возвращает ошибку 404. > > Как это исправить? > > Я хочу добиться поведения сервера à la Wikipedia, когда неважно, вводит ли > юзер "http://en.wikipedia.org/wiki/Signal_%28electrical_engineering%29" или > "http://en.wikipedia.org/wiki/Signal_(electrical_engineering)" -- он всегда > оказывается на нужной странице. > > Заранее спасибо! > > > > Дополнительная информация: > > System properties: > > Zend Framework 2 (дело точно не в раутинге, а в вэб-сервере -- запрос даже > не доходит до приложения), Debian 7, nginx 1.2.1, PHP 5.5. > > nginx.conf: > > user www-data; > worker_processes 4; > pid /var/run/nginx.pid; > > events { > worker_connections 768; > } > > http { > > sendfile on; > tcp_nopush on; > tcp_nodelay on; > keepalive_timeout 65; > types_hash_max_size 2048; > > include /etc/nginx/mime.types; > default_type application/octet-stream; > > access_log /var/log/nginx/access.log; > error_log /var/log/nginx/error.log; > > gzip on; > gzip_disable "msie6"; > > include /etc/nginx/conf.d/*.conf; > include /etc/nginx/sites-enabled/*; > } > > ax-common-vhost: > > server { > listen 80; > server_name > foo.loc > bar.loc > baz.loc > ; > > if ($host ~ ^(?<project>.+)\.(?<area>.+)\.loc$) { > #set $project $1; # already set > #set $area $2; # already set > > set $folder "$area/$project"; > #set $domain "$project.$area.loc"; # equal to $host > } > > access_log /var/log/nginx/$area/$project.access.log; > error_log /var/log/nginx/error.log; > > gzip on; > gzip_min_length 1000; > gzip_types text/plain text/xml application/xml; > > client_max_body_size 25m; > > root /var/www/$folder/public/; > > try_files $uri $uri/ /index.php?$args; > index index.html index.php; > > location / { > index index.html index.php; > sendfile off; > } > > location ~ (\.inc\.php|\.tpl|\.sql|\.tpl\.php|\.db)$ { > deny all; > } > > location ~ \.htaccess { > deny all; > } > > if (!-e $request_filename) { > rewrite ^.*$ /index.php last; > } > > location ~ \.php$ { > fastcgi_cache off; > #fastcgi_pass 127.0.0.1:9001; > fastcgi_pass unix:/var/run/php5-fpm.sock; > fastcgi_read_timeout 6000; > fastcgi_index index.php; > include fastcgi_params; > fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; > fastcgi_param APPLICATION_ENV development; > fastcgi_param HTTPS $https; > } > } > > Posted at Nginx Forum: > http://forum.nginx.org/read.php?21,241512,241512#msg-241512 > > _______________________________________________ > nginx-ru mailing list > nginx-ru@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx-ru _______________________________________________ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru