web icon indicating copy to clipboard operation
web copied to clipboard

fcgi support doesn't work on shared hosting services

Open ericvh opened this issue 14 years ago • 5 comments

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.

ericvh avatar Jun 29 '10 19:06 ericvh

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 avatar Jun 30 '10 16:06 hoisie

Looking into it now...

hoisie avatar Oct 17 '10 04:10 hoisie

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 avatar Oct 19 '10 23:10 hoisie

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

hoisie avatar Oct 20 '10 00:10 hoisie

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?

Remo avatar Dec 16 '11 13:12 Remo