I serve both php
and executable files via nginx
. Thus, I separate the by the extension of request URL as
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~ \.c$ {
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
With PHP
, the script to run has .php
extension; but for executable files, .hello.c
is the original script and its compiled executable is hello
file.
I need to run the hello
file when visiting https://example.com/hello.c
.
Is there any directive in nginx instead of $fastcgi_script_name
to get the script name without extension?