|
@ -29,7 +29,21 @@ $VLMCSD = array( // vlmcsd process |
|
|
'pidFile' => '/run/vlmcsd.pid', |
|
|
'pidFile' => '/run/vlmcsd.pid', |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$HELP_MSG = " |
|
|
|
|
|
kms-server ($VERSION) |
|
|
|
|
|
|
|
|
|
|
|
Project: https://github.com/dnomd343/kms-server.git |
|
|
|
|
|
|
|
|
|
|
|
--debug Enable debug mode |
|
|
|
|
|
--kms-port Specify kms listen port |
|
|
|
|
|
--http-port Specify http listen port |
|
|
|
|
|
--disable-http Disable http service |
|
|
|
|
|
--version Show version info |
|
|
|
|
|
--help Show help message |
|
|
|
|
|
\n"; |
|
|
|
|
|
|
|
|
function load_nginx_config(int $kms_port, int $http_port): void { |
|
|
function load_nginx_config(int $kms_port, int $http_port): void { |
|
|
|
|
|
global $VERSION; |
|
|
$nginx_config = "server { |
|
|
$nginx_config = "server { |
|
|
listen $http_port; |
|
|
listen $http_port; |
|
|
listen [::]:$http_port ipv6only=on; |
|
|
listen [::]:$http_port ipv6only=on; |
|
@ -44,6 +58,7 @@ function load_nginx_config(int $kms_port, int $http_port): void { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
location / { |
|
|
location / { |
|
|
|
|
|
set \$cli_mode false; |
|
|
include fastcgi_params; |
|
|
include fastcgi_params; |
|
|
fastcgi_pass unix:/run/php-fpm.sock; |
|
|
fastcgi_pass unix:/run/php-fpm.sock; |
|
|
if (\$http_user_agent ~* (curl|wget)) { |
|
|
if (\$http_user_agent ~* (curl|wget)) { |
|
@ -51,6 +66,7 @@ function load_nginx_config(int $kms_port, int $http_port): void { |
|
|
} |
|
|
} |
|
|
fastcgi_param KMS_PORT $kms_port; |
|
|
fastcgi_param KMS_PORT $kms_port; |
|
|
fastcgi_param KMS_CLI \$cli_mode; |
|
|
fastcgi_param KMS_CLI \$cli_mode; |
|
|
|
|
|
fastcgi_param KMS_VER $VERSION; |
|
|
fastcgi_param SCRIPT_FILENAME /kms-server/src/Route.php; |
|
|
fastcgi_param SCRIPT_FILENAME /kms-server/src/Route.php; |
|
|
}\n}\n"; |
|
|
}\n}\n"; |
|
|
logging::debug("Nginx configure ->\n" . $nginx_config); |
|
|
logging::debug("Nginx configure ->\n" . $nginx_config); |
|
@ -169,6 +185,16 @@ pcntl_signal(SIGQUIT, function() { // receive SIGQUIT signal |
|
|
exit; |
|
|
exit; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (in_array('-v', $argv) || in_array('--version', $argv)) { |
|
|
|
|
|
echo "\033[33mkms-server\033[0m => \033[36m$VERSION\033[0m\n"; // show version info |
|
|
|
|
|
exit; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (in_array('-h', $argv) || in_array('--help', $argv)) { |
|
|
|
|
|
echo $HELP_MSG; // show help message |
|
|
|
|
|
exit; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
logging::info('Loading kms-server (' . $VERSION . ')'); |
|
|
logging::info('Loading kms-server (' . $VERSION . ')'); |
|
|
load_params(); |
|
|
load_params(); |
|
|
load_vlmcsd_command($KMS_PORT); |
|
|
load_vlmcsd_command($KMS_PORT); |
|
|