$fastcgi_path_info is empty

Related software in use:

  • Ubuntu Server 24.04 LTS
  • Docker Engine v29.4.0
  • Docker Compose 5.1.3
  • Nginx v1.29.8

I cannot get $fastcgi_path_info to be anything but an empty string / null. When I try to hard-code it, it complains that it is a duplicate even though I remove almost all config settings and checked the conf.d to ensure no other file is in there…and the main config does not seem to set it either (and yes, I tried removing fastcgi_split_path_info since that is supposed to set the variable in the first place).

nginx configuration:

location /debug {
    add_header Content-Type text/plain;
    # This line creates the variables $fastcgi_script_name and $fastcgi_path_info
    fastcgi_split_path_info ^(.+\.php)(/?.*)$;
    return 200 "fastcgi_path_info: $fastcgi_path_info\nfastcgi_script_name: $fastcgi_script_name\ndocument_root: $document_root";
}

Result in browser going to /debug:
fastcgi_path_info:
fastcgi_script_name: /debug
document_root: /var/www/html

Result in browser going to /debug/fake/path/test?value=pair:
fastcgi_path_info:
fastcgi_script_name: /debug/fake/path/test
document_root: /var/www/html

Modified nginx configuration:
location /debug { add_header Content-Type text/plain; # This line creates the variables $fastcgi_script_name and $fastcgi_path_info fastcgi_split_path_info ^(.+\.php)(/?.*)$; set $fastcgi_path_info "/var/www/html"; return 200 "fastcgi_path_info: $fastcgi_path_info\nfastcgi_script_name: $fastcgi_script_name\ndocument_root: $document_root"; }

Result:
nginx: [emerg] the duplicate “fastcgi_path_info” variable in /etc/nginx/conf.d/default.conf:21

EDIT: In case anyone is wondering, I’m trying to get qdPM 9.3 working which uses an old Symfony library but it breaks anytime I try to add/view/edit projects because of the way it uses the URL to determine the action. It does not do this anywhere else in the app so everything works except Project-related URLs.

Nevermind. I could not get this to work in Nginx and switched the web container to Apache and was able to make that work.