i'll need a bit of help for alias on folder with nginx
I have my folder www/ with the container of my site example.com and a lot of folder like client0, client1, client2... I should NOT modify www/example/ but i need that example.com/serveur0/ to be redirected to www/client0/
I made a nginx rule like this :
location /serveur0/ {
alias /www/client0/;
index index.php
location ~ /serveur0/(.*\.php)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$1;
include /etc/nginx/fastcgi_params;
}
}
and it work perfectly. But i have some issues when i try to generalize it, using regex. I tried this
location /serveur([0-9]+)$/ {
alias /www/client$1/;
index index.php
location ~ /serveur$1/(.*\.php)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$1;
include /etc/nginx/fastcgi_params;
}
}
And it doesn't work, and i fail to understand why. Could you help me?