0
Posted by alex on Jan 20th, 2011

I found two simple way to disable fastcgi for a particular virtual host.

You can have full fastcgi.server for each vhost where you want to allow fastcgi, but this isn't very efficient because it will fork a lot of useless php/perl process. And that'll make a messy configuration.

The first way is to disable all fcgi for a vhost. It is possible by adding the following snippet inside the vhost (the $HTTP["host"] == "domain.td" {} block):

static-file.exclude-extensions = ()
fastcgi.server = ()
fastcgi.map-extensions = ()

The second way, and most likely the best way since you can have per-fcgi control, is to match on the file name by adding this snippet in the vhost configuration:

$HTTP["url"] =~ ".php$" {
	static-file.exclude-extensions = ()
	fastcgi.server = ()
}

 

The last method I tried was using a UUID to declare the fcgi, and then map it to its extension. The main problem with this, it's that if your client see your configuration file somehow, he will be able to run a script by renaming it to the UUID.

First, use a UUID instead of an extension to declare your fcgi servers:

fastcgi.server = ( "034343-43423423-php-342423" => ((
		"max-procs" => 1,
		"bin-path" => "/usr/bin/php-cgi",
		"bin-environment" => (
		"PHP_FCGI_CHILDREN" => "3",
		"PHP_FCGI_MAX_REQUESTS" => "250"
		),
		"socket" => "/tmp/php.socket"
	)),
	"034343-43423423-ruby-342423" => ((
		"max-procs" =>; 1,
		"bin-path" => "/usr/bin/custom-fcgi",
		"bin-copy-environment" => ("LANG", "TERM"),
		"socket" => "/tmp/ruby.socket"
	))
)
fastcgi.map-extensions = (".php" => "034343-php-342423", ".rb" => "034343-ruby-342423" )

And then redeclare the map-extensions inside the vhost configuration according to what you want to allow:
Eg, to disable php:

fastcgi.map-extensions = (".rb" => "034343-43423423-ruby-342423" )

 

I hope that one of those methods will help you!

0 comment
Connectez-vous ou postez en tant qu'invité:
Your Name Your Email


Vérification: 0385
Go to Top