Fcgiwrap and caddy

Hello I am trying to configure Caddy to work with fcgiwrap

here is what I use on Nginx:

location /cgi/ {
    try_files $uri $uri/ $uri.cgi?$args;
     root  /var/www/cgi;
     fastcgi_pass  unix:/var/run/fcgiwrap.socket;
     include /etc/nginx/fastcgi_params;
     fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
}

is any of you able to ‘translate’ this config into the equivalent for caddy ?

If it’s not a PHP app, then you can use reverse_proxy with the fastcgi transport:

we would like to run some perl scripts inside the folder located at /var/www/html/cgi-bin

www.test.com
root * /var/www/html/www.test.com
file_server

cgi.test.com {
	root * /var/www/html/cgi-bin
	reverse_proxy /bin/perl
}

fastcgi /var/www/html/cgi-bin/* /bin/perl {
	/var/www/html/cgi-bin
}

have no idea how to do this…

It’ll probably look something like this:

www.test.com {
	root * /var/www/html/www.test.com
	file_server
}

cgi.test.com {
	root * /var/www/cgi
	try_files {path} {path}/ {path}.cgi?{query}
	reverse_proxy unix//var/run/fcgiwrap.socket {
		transport fastcgi {
			[any fastcgi transport options you need]
		}
	}
}

thank you, it worked !

cgi.test.com {
	root * /var/www/cgi
	try_files {path} {path}/ {path}.cgi?{query}

	reverse_proxy unix//var/run/fcgiwrap.socket {
		transport fastcgi {
			split .cgi
		}
	}
	log {
	output file /var/log/caddy/access.log
	}
}

I end up putting split .cgi as transport

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.