nginx - How to set DOCUMENT_ROOT and SCRIPT_NAME correctly for fcgiwrap -


i've got simple script cpuinfo.sh works , executable.

i'm getting error

*224 fastcgi sent in stderr: "cannot script name, document_root , script_name (or script_filename) set , script executable?" while reading response header upstream, client: 86.44.146.39, server: staging.example.com, request: "get /cpuinfo.sh http/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "staging.example.com"

the nginx settings are

location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ {     gzip off;     autoindex on;     fastcgi_pass unix:/var/run/fcgiwrap.socket;     include fastcgi_params;     fastcgi_param document_root /home/balance/balance-infosystems-web/scripts/;     fastcgi_param script_filename $document_root$fastcgi_script_name; } 

i'm expecting fcgiwrap execute

/home/balance/balance-infosystems-web/scripts/cpuinfo.sh  

i hard coded script path debug i'm still getting same error.

location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ {     gzip off;     autoindex on;     fastcgi_pass unix:/var/run/fcgiwrap.socket;     include fastcgi_params;     fastcgi_param document_root /home/balance/balance-infosystems-web/scripts/;     # fastcgi_param script_filename $document_root$fastcgi_script_name;     fastcgi_param script_filename /home/balance/balance-infosystems-web/scripts/cpuinfo.sh; } 

what needs changed in nginx server config execute script correctly?

i discovered document_root can not reset. have scripts directories away publicly accessible paths. knew scripts directory same level web directory tried.

location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ {     gzip off;     autoindex on;     fastcgi_pass unix:/var/run/fcgiwrap.socket;     fastcgi_param script_filename $document_root/../scripts/$fastcgi_script_name;     include fastcgi_params ; } 

which resolved issue.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -