Hello
I need to use 2 different php versions depending on directory: Wordpress need php7.4 and flarum php 8.1...
server {
...
server_name example.com;
root /var/www/wordpress;
error_log /var/log/nginx/example.com-error.log;
access_log /var/log/nginx/example.com-access.log full;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ^~ /flarum {
root /var/www/wordpress/flarum;
try_files $uri $uri/ /index.php?$query_string;
location ~ \.php$ {
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php8;
}
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php7;
}
...
}
My nginx log output:
==> /var/log/nginx/example.com-error.log <==
2022/11/14 23:31:57 [error] 2100773#2100773: *4606812 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: x.x.x.x, server: example.com, request: "GET /flarum/index.php HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php-8.1.6-fpm.sock:", host: "example.com"
==> /var/log/nginx/example.com-access.log <==
x.x.x.x - - [14/Nov/2022:23:31:57 +0100] "GET https://example.com/flarum/index.php HTTP/2.0" 404 36 "-" "Mozilla/5.0 Gecko/20100101 Firefox/106.0" 0.001
Is anybody tried such config ? could you post me config example please.
Thank you all ;-)