feat(installer): Add web server config guidance post-installation

This commit is contained in:
Roman Kelesidis 2025-08-19 16:49:55 +03:00
commit 2153c1b0aa
No known key found for this signature in database
GPG key ID: D8157C4D4C4C6DB4
3 changed files with 33 additions and 4 deletions

View file

@ -319,6 +319,35 @@ if (!empty($DB_HOST) && !empty($DB_DATABASE) && !empty($DB_USERNAME)) {
}
}
// Suggest configuration files based on selected web server
out("\n--- Web Server configuration ---\n", 'info');
echo "Which web server are you using? (nginx / caddy / apache): ";
$webserver = mb_strtolower(trim(readline()));
$install_dir = 'install' . DIRECTORY_SEPARATOR;
switch ($webserver) {
case 'nginx':
$config_path = BB_ROOT . $install_dir . 'nginx.conf';
if (is_file($config_path)) {
out("- Nginx configuration file: $config_path", 'success');
} else {
out("- Nginx config not found: $config_path", 'warning');
out('- You can find an example in the documentation', 'info');
}
break;
case 'caddy':
$config_path = BB_ROOT . $install_dir . 'Caddyfile';
if (is_file($config_path)) {
out("- Caddy configuration file: $config_path", 'success');
} else {
out("- Caddy config not found: $config_path", 'warning');
out('- You can find an example in the documentation', 'info');
}
break;
}
sleep(3);
// Cleanup...
if (is_file(BB_ROOT . '_cleanup.php')) {
out("\n--- Finishing installation (Cleanup) ---\n", 'info');

View file

@ -1,7 +1,7 @@
# Example Caddy configuration for TorrentPier
example.com {
root * /path/to/root
root * /path/to/www
encode gzip zstd
php_fastcgi unix//run/php/php-fpm.sock
try_files {path} {path}/ /index.php?{query}

View file

@ -1,9 +1,9 @@
# Example nginx configuration for TorrentPier
server {
listen 80; # port
server_name example.com; # your domain
root /path/to/root; # folder with TorrentPier installed
listen 80;
server_name example.com;
root /path/to/www;
index index.php;
charset utf-8;