Greetings,
I’m trying to get a C compiled program to work using fcgi with nginx,
but I’m showed a 502 Bad Gateway.
The actual setup is : all programs in ./cgi-bin/*.cgi should use
fcgiwarp. The actual result is every adress matching report 502 Bad
Gateway.
I’m not sure of what I am missing :s
sudo service fcgiwrap status
[ ok ] Checking status of FastCGI wrapper: fcgiwrap running.
sudo netstat -anp | grep cgi
unix 2 [ ACC ] STREAM LISTENING 12743 4055/fcgiwrap
/var/run/fcgiwrap.socket
relevant extract of /etc/nginx/sites-available/blog
location ~ ^/cgi-bin/.*.cgi$ {
# Disable gzip (it makes scripts feel slower since they have to
complete
# before getting gzipped)
gzip off;
# Set the root to /usr/lib (inside this location this means that we
are
# giving access to the files under /usr/lib/cgi-bin)
root /usr/lib;
# Fastcgi socket
fastcgi_pass unix:/var/run/fcgiwrap.socket;
# Fastcgi parameters, include the standard ones
include /etc/nginx/fastcgi_params;
# Adjust non standard parameters (SCRIPT_FILENAME)
fastcgi_param SCRIPT_FILENAME /usr/lib$fastcgi_script_name;
}
tail -n 2 /var/log/nginx/error.log
2014/09/02 14:28:16 [error] 4324#0: *13 upstream prematurely closed
FastCGI stdout while reading response header from upstream, client:
127.0.0.1, server: notyugh.pwnz.org, request: “GET
/cgi-bin/helloworld.cgi HTTP/1.1”, upstream:
“fastcgi://unix:/var/run/fcgiwrap.socket:”, host: “localhost”
2014/09/02 14:28:27 [error] 4324#0: *13 upstream prematurely closed
FastCGI stdout while reading response header from upstream, client:
127.0.0.1, server: notyugh.pwnz.org, request: “GET
/cgi-bin/FILEDONTEXIST.cgi HTTP/1.1”, upstream:
“fastcgi://unix:/var/run/fcgiwrap.socket:”, host: “localhost”
More info :
nginx -V
nginx version: nginx/1.2.1
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx
–conf-path=/etc/nginx/nginx.conf
–error-log-path=/var/log/nginx/error.log
–http-client-body-temp-path=/var/lib/nginx/body
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi
–http-log-path=/var/log/nginx/access.log
–http-proxy-temp-path=/var/lib/nginx/proxy
–lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid
–with-pcre-jit --with-http_gzip_static_module
–with-http_ssl_module --with-ipv6 --without-http_browser_module
–without-http_geo_module --without-http_limit_req_module
–without-http_limit_zone_module --without-http_memcached_module
–without-http_referer_module --without-http_scgi_module
–without-http_split_clients_module --with-http_stub_status_module
–without-http_ssi_module --without-http_userid_module
–without-http_uwsgi_module
–add-module=/build/nginx-n55HQd/nginx-1.2.1/debian/modules/nginx-echo
dpkg -l | grep cgi
ii fcgiwrap 1.0.3-3
armhf simple server to run CGI applications over FastCGI
ii libfcgi0ldbl 2.4.0-8.1
armhf Shared library of FastCGI
ii php5-cgi 5.4.4-14+deb7u14
armhf server-side, HTML-embedded scripting language (CGI binary)
ii spawn-fcgi 1.6.3-1
armhf A fastcgi process spawner
uname -a
Linux armServ 3.4.67+ #1 SMP PREEMPT Tue Dec 17 20:45:43 CET 2013 armv7l
GNU/Linux