From 28ec73dc5b87d93ff6de7c8b490ae5274f6ea390 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 30 Jan 2011 11:38:16 +0100 Subject: [PATCH] MDL-26182 add detection of misconfigured nginx server --- lib/setuplib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/setuplib.php b/lib/setuplib.php index cbf6ffd5488..46028a71a6d 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -750,6 +750,9 @@ function setup_get_remote_url() { } else if (stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) { //nginx - not officially supported + if (!isset($_SERVER['SCRIPT_NAME'])) { + die('Invalid server configuration detected, please try to add "fastcgi_param SCRIPT_NAME $fastcgi_script_name;" to the nginx server configuration.'); + } $rurl['scheme'] = empty($_SERVER['HTTPS']) ? 'http' : 'https'; $rurl['fullpath'] = $_SERVER['REQUEST_URI']; // TODO: verify this is always properly encoded