How do I enable external access to a python fcgi app?
I have a simple web app which displays a simple hello wo开发者_StackOverflow社区rld
. I can access the app through the web browser (127.0.0.1:3000/test/hello), but cannot access it using the local ip the app is running on, or using my external ip (i have forwarded the port appropriately on my router).
server.modules += ( "mod_fastcgi" )
server.document-root = "/Users/me/test"
server.port = 3000
server.bind = "127.0.0.1"
fastcgi.debug = 1
fastcgi.server = (
"test" =>
(
"python-fcgi" =>
(
"socket" => "/tmp/fastcgi.python.socket",
"bin-path" => "/Users/me/hello.py",
"check-local" => "disable",
"max-procs" => 1,
)
))
How do I access the web app using my external ip?
Set server.bind
to the local network IP of the server rather than localhost 127.0.0.1
. Also check that port 3000 is not blocked between hosts on your network.
By binding to localhost you are bound to the loopback interface of your machine, which means that lighttpd is not even listening on the network at all.
Alternatively, to accept request no matter how they are directed to the server, bind to 0.0.0.0
which enables all interfaces.
Don't bind to a specific IP address, bind to 0.0.0.0
. This will allow you to access it on 127.0.0.1
as well as any external IP addresses.
Your server is binding/listening on the loopback interface. Change your server.bind
line to bind/listen on your machine's IP address instead.
精彩评论