Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Cockpit in Subfolder and Domain redirect #704
I'm trying to install cockpit for a friend.
Have a look at the bootstrap.php file, it looks for a defines file
Just create this file and add your constant (COCKPIT_DIR, COCKPIT_SITE_DIR, COCKPIT_CONFIG_DIR, etc...) to match the good path
that code does not exist in my bootstrap.php, these defines are directly inside bootstrap.php defined. My cockpit version is from end of 2017.
I also downloaded a more recent version where bootstrap contains the defines code but what does it help if I set any constant there when bootstrap.php overwrites them right away again or am I missing something?
You used the outdated legacy branch. In the master and next branches, cockpit checks for the defines.php file.
I tried to install Cockpit on a shared host (strato) on a subdomain. Your setup may differ a bit, but this is my setup for inspiration:
System: PHP7+, Apache
<?php define('COCKPIT_BASE_URL', '/admin'); define('COCKPIT_BASE_ROUTE', '/admin'); define('COCKPIT_DOCS_ROOT', dirname(__DIR__));
Without the last line, the redirect works fine, but all assets have wrong paths. After setting
For debugging and exploring all the paths, you could add this code to
<?php echo "<pre style='position:absolute;top:0;left:0;'>";//avoid pre to get centered (body CSS) print_r($_SERVER['DOCUMENT_ROOT']); // may differ from __DIR__ echo "\r\n"; print_r(get_defined_constants(true)['user']); // list all user constants print_r($app->config['paths']); // list all config paths echo "</pre>"; ?>