472,119 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Attempting to get lighttpd, fastcgi & python working

Hi folks,

I'm trying to get lighttpd, fastcgi & python working on a 2.4.21.x i686
linux system. I tried following the steps in:

http://www.cleverdevil.org/computing...i-and-lighttpd
Some of the lighttpd.conf setting are slightly different from those in
that article - fixing some erros in the original and accounting for
some change in entry formats itself.

All components were built by 'root' and binaries run by 'root'. Python
files (.py(c)) were deployed to '..../site-packages' and run with
execute prop turned on.

I'm trying to run lighttpd on "dev-1686linux.my.org:8090" with the
fastcgi server setup to listen on "127.0.0.1:8091". The problem I'm
having is that though lighttpd comes up and is able to serve static
content, it fails to bring up the WSGIServer and serve dynamic content
(simple "Hello World") generated by the py script (test.pcgi).

The errors I get are:
.....
[root@dev-i686linux myApp]# lighttpd -f ./lighttpd.conf

[root@dev-i686linux myApp]# Traceback (most recent call last):

File "/test/myApp/htdocs/test.fcgi", line 21, in ?
WSGIServer(myapp, bindAddress = ("127.0.0.1", 8091)).run()

File "/usr/lib/python2.4/site-packages/fcgi.py", line 1064, in run
sock = self._setupSocket()
Traceback (most recent call last):

File "/test/myApp/htdocs/test.fcgi", line 21, in ?
WSGIServer(myapp, bindAddress = ("127.0.0.1", 8091)).run()

File "/usr/lib/python2.4/site-packages/fcgi.py", line 1027, in
_setupSocket sock.bind(self._bindAddress)

File "/usr/lib/python2.4/site-packages/fcgi.py", line 1064, in run
sock = self._setupSocket()

File "/usr/lib/python2.4/site-packages/fcgi.py", line 1027, in
_setupSocket sock.bind(self._bindAddress)

File "<string>", line 1, in bind
socket.error: (98, 'Address already in use')

File "<string>", line 1, in bind
socket.error: (98, 'Address already in use')
....

It is unclear why it thinks the 127.0.0.1:8091 sock is already in use.
I ran this the first thing after a system reboot. No other apps are
using this port. I see this error no matter what port I choose, on the
server side. The browser sits there spinning and 'waiting' for the
response to url that incudes the .pcgi script.

The behviour is slightly different when I use UDSockets to listen on.
Again, I can see static content. When I try the py script, I see it
waiting indefinitely, but this time no errors are logged into the log
file. So no clue where it is hanging on the server side. The access
logs are not showing any "request" related entries even for the static
content that is being deliverd (albeit properly).

Can someone shed light on this. I thought if I can iron out this kink,
then I can get TurboGears (CherryPy ws) working with lighttpd and
fastcgi proxy-ing upfront.

Searched around quite a bit, but unable to find a clue. Would much
appreciate some pointers... Thanks a lot ...
/venkat
Following are the various config settings:

/test/myApp/lightpd.conf:
-------------------------
server.modules = (
"mod_rewrite",
"mod_access",
"mod_fastcgi",
"mod_accesslog" )
server.document-root = "/test/myApp/htdocs/"
server.errorlog = "/var/tmp/lighttpd.error.log"
index-file.names = ( "index.html", "index.htm" )
server.port = 8090
server.bind = "dev-1686linux.my.org"
server.error-handler-404 = "/test.fcgi"
fastcgi.server = ( ".fcgi" =>
(
(
"host" => "127.0.0.1",
"port" => 8091,
"bin-path" =>
"/test/myApp/htdocs/test.fcgi",
"min-procs" => 1
)
)
)

/test/myApp/htdocs/test.fcgi:
-----------------------------
#!/usr/bin/python2.4
# test.fcgi for myApp

from fcgi import WSGIServer

def myapp(environ, start_response):

print 'got request: %s' % environ
start_response('200 OK', [('Content-Type', 'text/plain')])
return ['Hello World!\n']

# use a tcp-socket based approach
WSGIServer(myapp, bindAddress = ("127.0.0.1", 8091)).run()

/test/myApp/fcgi.py:
--------------------
The WSCGIServer (fcgi.py) authored by Saddi is from:
http://svn.saddi.com/py-lib/trunk/fcgi.py
No mods here.

Mar 24 '06 #1
0 2087

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Peter Otten | last post: by
reply views Thread by fmcarol | last post: by
7 posts views Thread by Vincent Delporte | last post: by
2 posts views Thread by Sanders Kaufman | last post: by
4 posts views Thread by John Nagle | last post: by
9 posts views Thread by Gilles Ganault | last post: by
2 posts views Thread by Gilles Ganault | last post: by
1 post views Thread by Ivan Voras | last post: by
1 post views Thread by Gilles Ganault | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.