# Problems, hosting cockpit in a subfolder on uberspace

**URL:** <https://discourse.getcockpit.com/t/problems-hosting-cockpit-in-a-subfolder-on-uberspace/1732>\
**Category:** Support\
**Created:** [December 4, 2020, 4:31pm UTC](https://discourse.getcockpit.com/t/problems-hosting-cockpit-in-a-subfolder-on-uberspace/1732 "2020-12-04T16:31:06Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [December 10, 2020, 11:48am UTC](https://discourse.getcockpit.com/t/problems-hosting-cockpit-in-a-subfolder-on-uberspace/1732/5 "2020-12-10T11:48:48Z")

</div>

@nino1337 I was able to reproduce your setup with the help of this thread (working example for Uberspace in a secondary docs root, but not in a subfolder):

> [@Can't access api](https://discourse.getcockpit.com/t/cant-access-api/221/12):
>
> @Tummerhore I tried it myself now. Steps to reproduce: Install Cockpit in the default docs root to see the expected paths. username.uber.space points to /var/www/virtual/username/html cd ~/html git clone https://github.com/agentejo/cockpit.git . nano bootstrap.php --\> add debugging snippet directly after the constants defines and before function cockpit(...) starts echo "\<pre style='position:absolute;top:0;left:0;'\>"; //avoid pre to get centered (body CSS) print\_r($\_SERVER['DOCUMENT\_ROOT…

This works, if your cockpit instance is in a subfolder `/cms`:

```bash
# connect domain
uberspace web domain add test.domain.tld

# set A and AAAA records at your domain provider...

# create docs root
cd /var/www/virtual/$USER
mkdir test.domain.tld
cd test.domain.tld

git clone https://github.com/agentejo/cockpit.git cms

cd cms

nano .htaccess
# set RewriteBase /cms
# Be aware, that .htaccess might be overridden with the next cockpit update

nano defines.php
# set constants (see below)

```

defines.php:

```php
<?php
define('COCKPIT_BASE_URL', '/cms');
define('COCKPIT_BASE_ROUTE', '/cms');
define('COCKPIT_DOCS_ROOT', dirname( __DIR__ ));
define('COCKPIT_SITE_DIR', dirname(dirname( __DIR__ )));

```

---

_[View the full topic](https://discourse.getcockpit.com/t/problems-hosting-cockpit-in-a-subfolder-on-uberspace/1732)._
