I've stuck on simple thing, please help. I have 2 directories with PHP projects: /var/www/api/ and /var/www/api-beta/. I want to forwarding each of them to PHP-FPM. Nginx config:
server {
listen 80;
set $doc_root /var/www/api;
root $doc_root;
index index.php index.html;
location /beta {
alias /var/www/api-beta;
}
location ~ \.php$ {
set $php_root /var/www/api;
if ($request_uri ~* /beta) {
set $php_root /var/www/api-beta;
}
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
I've tried do this with if ($request_uri ~* /beta)
but it didn't work. I think problem this, because project from /var/www/api works fine, but from /var/www/api-beta I have "File not found." error.