hoisie / web

The easiest way to create web applications with Go
MIT License
3.67k stars 702 forks source link

fcgi support doesn't work on shared hosting services #30

Open ericvh opened 14 years ago

ericvh commented 14 years ago

Many shared hosting services (ie. dreamhost for me) don't allow you to specify an external fcgi by address:port and instead using fd 0 as the listen socket for the FastCGI. It would be cool if web.go supported this mode of operation unlocking relatively cheap hosting of go applications.

hoisie commented 14 years ago

I believe web.go doesn't work with unix sockets, which is a common configuration for fastcgi in hosted environments. I investigated some potential problems in the unix socket package, but that didn't lead to anything. Ill try to take another look.

Thanks for reporting

hoisie commented 14 years ago

Looking into it now...

hoisie commented 14 years ago

The reason it doesn't work is that Apache expects the Go program to have a traditional CGI interface -- the input it passed via STDIN and the output is through STDOUT.

After today's commit, which gives web.go the ability to control logging, this shouldn't be too difficult to support.

hoisie commented 14 years ago

Why doesn't that work? Is there an error message?

Remo commented 12 years ago

I've been trying to switch my default Apache+PHP configuration to Apache+web.go but without any success so far.

My FCGI starter script looks like this

#!/bin/sh

umask 022
exec /usr/bin/hello

I'm not sure how the communication works in such a configuration as there's no port specified anywhere. I just know that this would work with PHP. The only thing I get when I send a request to Apache is the status code 500 along with the following entry in my log file:

[Fri Dec 16 14:26:23 2011] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Fri Dec 16 14:26:23 2011] [error] [client 1.2.3.4] Premature end of script headers: php5-fcgi-starter

Any ideas on this?