Change cockpit entrypoint url



I’m trying to host cockpit and a node.js server on the same production server. I’m using Nginx to dispatch the access to the two servers based on the requested url.

The idea is that for any url I’d want to forward the traffic to the node.js server exposed on localhost:3000.
Instead I’d like to forward all the urls starting with ‘cms’ or ‘cockpit’ or any other differentiator to cockpit cms exposed on localhost:8080.

So I’m trying a way to change the cockpit entry point for all its paths. For example:
localhost:8080/auth/login should be localhost:8080/cockpit/auth/login
localhost:8080/collections should be localhost:8080/cockpit/collections

in this way I can tell Nginx to forward any traffic to cockpit cms based on if the url starts with cockpit.

Is there a way to do it?
Thank you


I’m trying to reverse proxy cockpit cms that run with Docker.

In the official documentation I found ( that I can change the site url:

 # site url (optional) - helpful if you're behind a reverse proxy
'site_url' => '',

But it doesn’t really work.

I also tried to edit the define.php file adding some definitions:
define(‘COCKPIT_BASE_URL’, ‘/admin’);
define(‘COCKPIT_BASE_ROUTE’, ‘/admin’);
define(‘COCKPIT_DOCS_ROOT’, “/var/www/html”);

I got to have cockpit forward itself to admin/… but some routes don’t work yet.

Thank you


@alessandro If you try to understand the paths and constants, have a look here:

I’m not sure, how to achieve the forwarding, but maybe… it could be easy… Put Cockpit in a subdirectory named cockpit–> now your url is localhost:8080/cockpit/auth/login

Or add a line to the .htaccess to rewrite some specific urls.

And you started a second thread

Have a look at index.php of Cockpit:

Maybe this might work: define the constant COCKPIT_ADMIN_ROUTE in /config/bootstrap.php to your needs.


Hey @alessandro, think issue is not on cockpit but on nginx configuration, basically what you need is: => http://localhost:8080

location /cockpit {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;