You are not logged in.
Pages: 1
I am stuck setting my nginx to work with custom cgi programs (using xmlrpc-c library).
I am trying with fcgiwrap/spawn-fcgi like this:
$ spawn-fcgi -f /usr/bin/fcgiwrap -s /tmp/fcgi.sock
Important section of nginx.conf file would be
location /cgi-bin/test {
root /usr/share/nginx/html/cgi-bin/test/;
include /etc/nginx/fastcgi.conf;
#fastcgi_pass 127.0.0.1:8000;
fastcgi_pass unix:/tmp/fcgi.sock;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/cgi-bin/test$fastcgi_script_name;
}
I've tried both soceket files and ipv4/portnumber combinations but i got error:
2013/08/22 18:52:55 [notice] 1645#0: signal process started
2013/08/22 18:52:57 [crit] 1653#0: *1 connect() to unix:/tmp/fcgi.sock failed (13: Permission denied)
while connecting to upstream, client: 127.0.0.1, server: localhost,request: "POST /cgi-bin/test/listaccounta HTTP/1.1", upstream: "fastcgi://unix:/tmp/fcgi.sock:", host: "localhost", referrer: "http://localhost/some_page.php"
I also get 502 Bad Gateway sometimes if I mess around with options. I've tried every combination I could google (includes modifying /etc/nginx/fastcgi.conf file)
(note there are separate sections in nginx.conf for php cgi and for my test programs, php works fine)
I am stuck and don't know how to configure it, am I missing something out?
Thanks
Offline
What user owns the socket in /tmp/fcgi.sock? What permissions does the socket have?
Last edited by Morrad (2013-08-22 23:06:37)
Offline
I suspected this as well, tried both chmod a+rwx /tmp/fcgi.sock as well as running those services as root, same error (permission denied) .
Also, when i tried using tcp sockets got an error:
2013/08/23 01:16:01 [notice] 6433#0: signal process started
2013/08/23 01:16:04 [error] 6448#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "POST /cgi-bin/test/testprog HTTP/1.1", upstream: "fastcgi://127.0.0.1:8000", host: "localhost", referrer: "http://localhost/script.php"
so i think problem is somewhere else..
Last edited by kometonja (2013-08-22 23:19:19)
Offline
this part especially:
in nginx.conf
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/cgi-bin/test/$fastcgi_script_name; #desn't work, reports error below
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/cgi-bin/test/my_prog; #it works
Cannot get script name, are DOCUMENT_ROOT and SCRIPT_NAME (or SCRIPT_FILENAME) set and is the script executable?
i have more than one program, how to set executable not to be fixed (like my_prog above)?
Offline
Pages: 1