I had similar problem. The problem is with rewrite rule and route but for me it was not a simple one. I try two days to solve that without result.
In final I solve it but with different approach by setting a virtual server for each site and thus every site has a clean root. For external access may need to open listen ports (set permissive your firewall rule).
/etc/nginx/sites-enabled/store_a
server {
listen your.local.host.server.ip:80;
server_name redrent;
index index.php index.html index.htm;
set $root_path '/var/www/phalcon.dev/store_a/public';
root $root_path;
location / {
try_files $uri $uri/ /index.php?_url=$uri&$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
/etc/nginx/sites-enabled/store_b
server {
listen your.local.host.server.ip:81;
server_name redrent;
index index.php index.html index.htm;
set $root_path '/var/www/phalcon.dev/store_b/public';
root $root_path;
location / {
try_files $uri $uri/ /index.php?_url=$uri&$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
Please note that the listen directive have different ports according with $root_path.
Hope to be helpful.