Debugging an SCGI (localhost, Linux) and configuring lighttpd for it.
Added by Basile_S over 13 years ago
Hello, I am just debugging an SCGI program I am developing in C (bark.scgi is the executable name) on a local Linux/Ubuntu/Maeverick or Linux/Debian/Sid AMD64 machine.
I was thinking of starting manually my SCGI program (either under GDB, or in an xterm) by hand and having lighttpd communicate with it thru a Unix socket.
The lighttpd is only on localhost.
What is the right procedure for that?
I have the following configuration file
## file /etc/lighttpd/conf-available/95-barkscgi.conf scgi.debug = 7 scgi.server = ("/bark.scgi" => ("127.0.0.1" => ( "bin-path" => "/home/basile/BarkSCgi2011/bark.scgi -D -D -D -s /tmp/barkscgi.socket", "min-procs" => 1, "max-procs" => 1, "idle-timeout" => 100, "socket" => "/tmp/barkscgi.socket" )) )
But I would really want to start my scgi by hand (running under my user, basile, not under www-data which is the user for lighttpd). I would support bin-path should not be given, but it probably don't work without.
In particular, I want to be sure that lighttpd does not start the bark.scgi process itself, but communicates with a process I previously started in a terminal (or a debugger) thru the /tmp/barkscgi.socket
Again, all this is not in production mode, only for development and test. The lighttpd is on my desktop hopefully started once, my bark.scgi
program also (started in a debugger or a terminal), the browser (Firefox 3.6) also, and there is only one HTTP client at most in practice for the lighttpd server.
(BTW, I would believe this should be a FAQ).
Cheers
[[http://starynkevitch.net/Basile Basile Starynkevitch]] (near Paris, France)
Replies (4)
RE: Debugging an SCGI (localhost, Linux) and configuring lighttpd for it. - Added by stbuehler over 13 years ago
spawn-fcgi can spawn scgi apps too (both expect the listening fd on fd 0).
RE: Debugging an SCGI (localhost, Linux) and configuring lighttpd for it. - Added by Basile_S over 13 years ago
But I don't want lighttpd to start my SCGI process. I want lighttpd to communicate with an SCGI process I did start under a debugger or in a terminal.
RE: Debugging an SCGI (localhost, Linux) and configuring lighttpd for it. - Added by icy over 13 years ago
Just specify the socket path then.
RE: Debugging an SCGI (localhost, Linux) and configuring lighttpd for it. - Added by Basile_S over 13 years ago
Thanks, but something don't work.
Lighttpd access.log & error.log are
glinka.x86_64 ~/BarkFastCgi2011 11:47 % cat /var/log/lighttpd/access.log 0 127.0.0.1 localhost - [03/Nov/2010:11:46:58 +0100] "GET /bark.scgi HTTP/1.1" 403 345 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.10 (maverick) Firefox/3.6.12" 127.0.0.1 localhost - [03/Nov/2010:11:47:01 +0100] "GET /favicon.ico HTTP/1.1" 404 345 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.10 (maverick) Firefox/3.6.12" glinka.x86_64 ~/BarkFastCgi2011 11:47 % cat /var/log/lighttpd/error.log 0 2010-11-03 11:46:15: (log.c.166) server started 2010-11-03 11:46:58: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:46:59: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:00: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:01: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:02: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:03: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:04: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:05: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:06: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:07: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:08: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:09: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:10: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:11: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:12: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:13: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:14: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:15: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:16: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:17: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:18: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:19: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:20: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:21: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:22: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:23: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:24: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:25: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0 2010-11-03 11:47:26: (mod_scgi.c.2079) proc: 0 /tmp/barkscgi.socket 1 0 0 0
Configuration file is
## file /etc/lighttpd/conf-available/95-barkscgi.conf scgi.debug = 7 scgi.server = ("/bark.scgi" => ("127.0.0.1" => ( "socket" => "/tmp/barkscgi.socket" )))
And I am getting a 403 - Forbidden error on Ubuntu/Maeverick, unchanged lighttpd.conf except
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
The document root is /var/www and contains
% ls -l /var/www 0 total 4 -rw-r--r-- 1 root root 0 Nov 3 11:40 bark.scgi -rw-r--r-- 1 root root 3625 Nov 3 11:53 index.lighttpd.html
And by browsing http://localhost/ I am reading the (just changed) index.lighttpd.html