httpd slowcgi notes

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

httpd slowcgi notes

Elijah Buck
Hello,

I've upgraded my 5.4 server to 5.5 and then 5.6 and have switched
from nginx to httpd. This is all excellent.

I wanted to share how I made httpd work for me. I host a simple
static site, but also need '301 Moved Permanently' support, which
httpd does not seem to support at this time. However, httpd does
support FastCGI, so I use a small Perl CGI script called via slowcgi
to set the 301 redirect header.

It is a bit underdocumented that the 'root' httpd option can be
used to tell slowcgi which script to execute.

##httpd.conf##

ext_addr="egress"
server "www.example.com" {
        listen on $ext_addr port 80
}
server "old.example.com" {
        listen on $ext_addr port 80
        fastcgi socket "/run/slowcgi.sock"
        root "/cgi-bin/redir.pl"
}


##redir.pl##

#!/usr/bin/perl -Tw
use CGI;
my $q = CGI->new();
print $q->redirect(
  -location => 'http://www.example.com',
  -status => '301 Moved Permanently',
);

You will also have to setup perl in the chroot and start slowcgi.

Cheers,
Elijah

Reply | Threaded
Open this post in threaded view
|

Re: httpd slowcgi notes

Jean-Francois Simon
Hi All,

With httpd as of 5.6 I do not understand how to make cgi script work eg
just bgokg installed by default at address /cgi-bin/bgplg

==httpd.conf==

prefork 2

server "local" {
listen on egress port 80
}

server "local-fastcgi" {
listen on egress port 80
fastcgi
}

==EOF==

/etc/rc.d/httpd start
/etc/rc.d/slowcgi -f start

Resulting in "Not Found /cgi-bin/bgplg"
Whereas the httpd server normally serves other html files of the htdocs
directlry, except /bgplg

Could you help me with the miss here ?

Regards

J.F.

Reply | Threaded
Open this post in threaded view
|

Re: httpd slowcgi notes

Quentin Rameau
Hi,

> server "local-fastcgi" {
> listen on egress port 80
> fastcgi
> }

have you tried specifying the fastcgi socket ?