Run Multiple Geeklog Sites from a Single Installation
- Monday, October 20 2025 @ 11:26 pm EDT
- Contributed by: ::Ben
- Views: 137
I currently run several independent Geeklog websites — each with its own database, theme, and data — using one shared installation of Geeklog. This setup is simple, efficient, and ideal for multilingual or multi-domain projects.
🧩 The Concept
Geeklog is normally designed to run one site per installation. In this setup, all sites share the same core codebase, but db-config.php and siteconfig.php detect the domain name ($_SERVER['HTTP_HOST']) to load the correct configuration for each website.
Each domain gets:
- Its own database (for isolated content)
- Its own folders for data, logs, and images
- Its own theme and URL settings
All logic resides inside the standard Geeklog configuration files — no plugins, no external includes.
⚙️ Example of db-config.php
📁 File location:
/home/exampleuser/db-config.php
if (strpos(strtolower($_SERVER['PHP_SELF']), 'db-config.php') !== false) {
die('This file can not be used on its own!');
}
global $_DB_host, $_DB_name, $_DB_user, $_DB_pass, $_DB_table_prefix, $_DB_dbms;
$_DB_table_prefix = 'gl_';
$_DB_dbms = 'mysql';
// Site One
if ($_SERVER['HTTP_HOST'] == 'www.site-one.com' || $_SERVER['HTTP_HOST'] == 'site-one.com') {
$_DB_host = 'localhost';
$_DB_name = 'db_site_one';
$_DB_user = 'user_site_one';
$_DB_pass = 'password_one';
}
// Site Two
if ($_SERVER['HTTP_HOST'] == 'site-two.com') {
$_DB_host = 'localhost';
$_DB_name = 'db_site_two';
$_DB_user = 'user_site_two';
$_DB_pass = 'password_two';
}
This allows Geeklog to connect to a different database depending on which domain is being visited.
⚙️ Example of siteconfig.php
📁 File location:
/home/exampleuser/public_html/siteconfig.php
if (strpos(strtolower($_SERVER['PHP_SELF']), 'siteconfig.php') !== false) {
die('This file can not be used on its own!');
}
global $_CONF, $_CONF_FCK;
// Common paths
$_CONF['path'] = '/home/exampleuser/';
$_CONF['path_system'] = $_CONF['path'] . 'system/';
$_CONF['path_html'] = $_CONF['path'] . 'public_html/';
$_CONF['path_language'] = $_CONF['path'] . 'language/';
$_CONF['path_editors'] = $_CONF['path_html'] . 'editors/';
$_CONF['path_pear'] = $_CONF['path'] . 'system/pear/';
$_CONF['default_charset'] = 'utf-8';
// Site One
if ($_SERVER['HTTP_HOST'] == 'www.site-one.com' || $_SERVER['HTTP_HOST'] == 'site-one.com') {
$_CONF['path_data'] = $_CONF['path'] . 'data/site-one/';
$_CONF['path_log'] = $_CONF['path'] . 'logs/site-one/';
$_CONF['path_images'] = $_CONF['path_html'] . 'images/site-one/';
$_CONF['cookiedomain'] = 'site-one.com';
}
// Site Two
if ($_SERVER['HTTP_HOST'] == 'site-two.com') {
$_CONF['path_data'] = $_CONF['path'] . 'data/site-two/';
$_CONF['path_log'] = $_CONF['path'] . 'logs/site-two/';
$_CONF['path_images'] = $_CONF['path_html'] . 'images/site-two/';
$_CONF['site_url'] = 'https://site-two.com';
$_CONF['site_admin_url'] = 'https://site-two.com/admin';
$_CONF['theme'] = 'custom_theme_two';
$_CONF['cookiedomain'] = 'site-two.com';
}
Each domain now loads its own paths and design while still relying on the same core Geeklog system files.
🚀 Why It Works So Well
- One shared codebase: only one Geeklog installation to maintain and update.
- Isolated data: each domain uses its own database and storage folders.
- Native integration: no plugin, no additional layer — 100% Geeklog compliant.
- Easy expansion: adding a new site means adding a few simple lines to both config files.
This approach is particularly useful for multilingual setups or networks of related projects.
⚠️ Limitation During Updates
The only drawback: during a Geeklog update, the installer might overwrite db-config.php and siteconfig.php. Since your multi-site logic lives in these two files, you’ll need to reapply your domain rules after each update.
🧰 Recommended Maintenance Steps
Before updating Geeklog:
cp /home/exampleuser/db-config.php /home/exampleuser/backups/db-config.php.backup
cp /home/exampleuser/public_html/siteconfig.php /home/exampleuser/backups/siteconfig.php.backup
After the update:
- Open the new configuration files installed by Geeklog.
- Copy back your domain detection blocks.
- Save and test your websites — everything should work immediately.
This process takes only a minute and keeps the setup compatible with all Geeklog releases.
🧠 Why Keep This Method
Even if two files must be updated manually after each upgrade, this solution remains the simplest, most stable, and easiest to understand.
- No external dependencies
- No plugin management
- No risk of incompatibility
- Full control over each site’s configuration
In short, it’s the perfect balance between flexibility and simplicity: a single Geeklog installation serving multiple, completely independent sites.