I have a problem getting php scripts to execute in internal
sites loaded via X-accl-Redirect.. My /etc/nginx/sites-enabled/devdb.easy-ads.com
file contains:
server {
root /srv/http/devdb.easy-ads.com/www;
index index.html index.htm index.nginx-debian.html index.php;
server_name devdb.easy-ads.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
error_page 404 = /index.php;
location /phpmyadmin_internal {
internal;
alias /srv/http/phpmyadmin;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/devdb.easy-ads.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/devdb.easy-ads.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
and in /srv/http/devdb.easy-ads.com/www/index.php
i have:
<?php
header("X-Accel-Redirect: /phpmyadmin_internal/test2.txt");
and everything works great, it loads the file /srv/http/phpmyadmin/test2.txt
just as expected. However when I change it to
<?php
header("X-Accel-Redirect: /phpmyadmin_internal/test.php");
it just serves a 404 error, instead of executing /srv/http/phpmyadmin/test.php
.. what gives? how can i get it to execute php scripts on internal
sites?
(what i THINK is happening, is that it asks php-fpm to load the literal url /phpmyadmin_internal/test.php
, not properly giving it a new uri/root-dir before sending it off to php-fpm, but i don't actually know.)