diff --git a/nginx/kms.conf b/nginx/kms.conf index c246283..4fd157a 100644 --- a/nginx/kms.conf +++ b/nginx/kms.conf @@ -8,14 +8,13 @@ server { } location / { - set $query_param $query_string; - if ($http_user_agent ~* (curl|wget)) { - set $query_param $query_param&cli=true; - } include kms_params; include fastcgi_params; fastcgi_pass unix:/run/php-fpm.sock; - fastcgi_param QUERY_STRING $query_param; + if ($http_user_agent ~* (curl|wget)) { + set $cli_mode "true"; + } + fastcgi_param KMS_CLI $cli_mode; fastcgi_param SCRIPT_FILENAME $kms_dir/src/Route.php; } } diff --git a/src/Route.php b/src/Route.php index e0aa384..7d2f13b 100644 --- a/src/Route.php +++ b/src/Route.php @@ -5,6 +5,13 @@ require_once 'Check.php'; require_once 'KmsCli.php'; require_once 'KmsWeb.php'; +if (getenv("KMS_CLI") === 'true') { + echo "cli mode" . PHP_EOL; +} else { + echo "not cli mode" . PHP_EOL; +} +return; + $kmsHost = getHost(); // kms server address $kmsPort = getPort(); // kms server port $url = $_SERVER['DOCUMENT_URI']; // request url