![]() |
"Because Nginx cannot directly execute external programs (CGI), a malicious person can't trick your system into uploading and executing an arbitrary script."
nginx-fcgi is a perl script to provide simple cgi support for nginx http daemon, it's still in development by
Daniel Dominik Rudnicki.
nginx-fcgi for now is only a simple perl script. Based at NginxSimpleCGI - Nginx Wiki.
The current version is
nginx-fcgi-0.4.3, md5sum (40a5f7a2c2e7c44463f5e9b66502c537)
suggested name /usr/sbin/nginx-fcgi
The sources are licensed under a BSD-like license.
Requires:
location ~ ^/cgi-bin/.*\.cgi$
{
fastcgi_pass unix:/var/run/nginx-fcgi.sock;
fastcgi_read_timeout 5m;
fastcgi_index index.cgi;
#
# You may copy and paste the lines under or use include directive
# include /etc/nginx/nginx-fcgi.conf;
# In this example all is in one file
#
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
}
#!/usr/bin/perl -wT
print "Content-type: text/html\n\n";
print "<html><head><title>Hello World</title></head>\n";
print "<body>\n";
print "<h2>Hello, world!</h2>\n";
print "</body></html>\n";
/var/log/nginx/*.log {
olddir /var/log/archive/nginx
create 644 nginx nginx
sharedscripts
postrotate
/sbin/service nginx graceful > /dev/null
endscript
}
# User and Group to use for spawned FCGI app.
SPAWN_UID="nginx"
SPAWN_GID="nginx"
# Bind to unix-domain socket, running as above
SPAWN_SOCKET="/var/run/nginx-fcgi.sock"
# Bind to tcp port 1026 on localhost.
# Address myst be IPv4 not name.
#SPAWN_PORT="1026"
#SPAWN_ADDR="127.0.0.1"
# log file
SPAWN_LOG="/var/log/nginx/nginx-fcgi.log"
# pid file
SPAWN_PID="/var/run/nginx-fcgi.pid"
# extra options
SPAWN_OPT=""
#SPAWN_OPT="verbose"