http-cgi #
Brings CGI support to Nginx and Angie webserver.
Source: upstream source
Directives
cgi #
syntax: cgi 1+ args; · context: server, location
If: You are also a fun of CGI If you have any problem with nginx-cgi If you want to get update of nginx-cgi If you want to know more friends Please join us: <https://discord.gg/EJSfqHHmaR>. ## Benchmark CGI is not as slow as people normally think.
cgi_body_only #
syntax: cgi_body_only on | off (on/off flag); · context: server, location
Default: empty #### cgi_body_only <on|off> A standard CGI script should output two parts: header and body.
cgi_interpreter #
syntax: cgi_interpreter any args; · context: server, location
If you clearly set cgi_interpreter, it's okay to remove this line, otherwise missing of shebang will causes a 500 error.
cgi_pass #
syntax: cgi_pass 1+ args; · context: server, location
Default: off #### cgi_pass <script_path> Alias of cgi pass <script_path>. #### cgi_interpreter [interpreter] [args...] Set interpreter and interpreter args for cgi script.
cgi_path #
syntax: cgi_path 1 arg (string); · context: server, location
Default: off #### cgi_path <PATH> Change cgi script PATH environment variable.
cgi_rdns #
syntax: cgi_rdns 1 arg; · context: server, location
If you mind this matter, you should avoid this. stderr: redirect CGI stderr to nginx process's stderr file <path_to_file>: redirect CGI stderr to a file #### cgi_rdns <on|off|double> [required] Enable or disable reverse dns.
cgi_set_var #
syntax: cgi_set_var 2 args; · context: server, location
Default: on #### cgi_set_var <name> <value> Add and pass extra environment variables to CGI script.
cgi_stderr #
syntax: cgi_stderr 1 arg; · context: server, location
But it's not recommanded, it may introduce confusing issues to your system. #### cgi_stderr <off|info|warn|error|crit|alert|emerg|stderr> #### cgi_stderr file <path_to_file> By default, nginx-cgi grab cgi script's stderr output and dump it to nginx log with warn level.
cgi_strict #
syntax: cgi_strict on | off (on/off flag); · context: server, location
If cgi_strict is on, nginx-cgi will check all cgi output headers, and 500 error will be responsed if invalid header found.
cgi_timeout #
syntax: cgi_timeout 1 arg; · context: server, location
Sends TERM and, if still running, KILL signals to a CGI process that exceeds the configured time limits.
cgi_working_dir #
syntax: cgi_working_dir 1 arg; · context: server, location
Default: empty #### cgi_working_dir <dir> Set the working directory of CGI script.
Example
daemon off;
master_process off;
error_log /dev/stderr debug;
load_module ../../nginx/objs/ngx_http_cgi_module.so;
events {
# Mac OS has a limitation of 255 file descriptors by default
worker_connections 128;
}
http {
server {
listen 8000;
root html;
# http2 on;
location /cgi-bin {
cgi on;
# cgi_timeout 10 5;
}
location /cgi {
rewrite ^/cgi/(.*)$ /cgi-bin/$1 last;
}
}
}