Hey all,
We have Zend Framework running just fine on nginx, but we're having trouble installing a profiling tool called xhprof. It seems that no matter how we try to install xhprof, all requests to it are being given to ZF through fastcgi. I had a nice long chat with "merlincorey" in IRC but we didn't get very far. He seemed to think it was a fastcgi configuration issue, but I'm convinced it's either a problem in nginx or ZF.
our primary web path is /var/www/foo/
- under that disk path, we have ZF installed, so we have a /public/ folder where its index.php lives. (/var/www/foo/public/index.php)
- under the same disk path, we have XHProf installed (/var/www/foo/xhprof) which has two folders, xhprof_html and xhprof_lib for managing a UI screen of profiling info. There's an index.php file in the xhprof_html folder (so, /var/www/foo/xhprof/xhprof_html/index.php), but there are other PHP scripts in there as well.
What we want to have:
http://foo.com/ <-- pulls up our ZF web site
http://foo.com/xhprof <-- pulls up the XHProf UI
What I've tried:
[code]server {
listen 80;
server_name .foo.com;
access_log /var/log/nginx/localhost.access.log;
root /var/www/foo/public;
location / {
if(!-e $request_filename) {
rewrite ^(*.)$ /index.php last;
break;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
}
location *~ ^.+.(html|js|ico|gif|jpg|png|css|swf|flv|pdf|xml) {
}
location ~ /\.ht {
deny all;
}
}[/code]
However, when I go to http://foo.com/xhprof I see that control is handed over to the Zend Framework.
"merlincorey" suggested other configurations, but none of them worked. It seems that every request was handed to the Zend Framework, even if we added a block for xhprof like this:
[code]server {
listen 80;
server_name .foo.com;
access_log /var/log/nginx/localhost.access.log;
root /var/www/foo/public;
location /hxprof {
root /var/www/foo/xhprof/xhprof_html;
}
location / {
if(!-e $request_filename) {
rewrite ^(*.)$ /index.php last;
break;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
}
location *~ ^.+.(html|js|ico|gif|jpg|png|css|swf|flv|pdf|xml) {
}
location ~ /\.ht {
deny all;
}
}[/code]
This has us quite puzzled here, and any ideas would be very much welcomed. We even tried putting the /xhprof/ path inside the ZF /public/ folder (/var/www/foo/public/xhprof/) but that didn't do anything either. No matter what I've tried, trying to access http://foo.com/xhprof (or foo.com/xhprof/ or foo.com/xhprof/index.php) redirects my request to the Zend Framework which then tries to find an appropriate controller/action.
Thanks for any assistance.