2
I use PHP with the Phalcon framework in my projects and this is the structure.
My Nginx is like this:
server {
listen 80;
server_name 123.123.123.123;
root /var/www/meusite.com.br;
location @site{
rewrite ^/public(.+)$ /public/index.php?_url=$1 last;
}
location / {
index index.php;
if ($uri !~ ^/public) {
rewrite ^(.*)$ /public$1;
}
try_files $uri $uri/ @site;
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root /var/www/meusite.com.br/public;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
It is working fine, only now when an internal folder is requested, I need Nginx to ignore all "Location /" and execute the same commands of "Location /" but inside the requested folder. For example /v2/.
How do I do that? I’ve tried it in many ways. I’ve already Google it. Anyway, my biggest problem is because Phalcon uses a different folder structure than usual.