How to change Checkmk server URL?

Hello,

I have the need to modify the URL to access Checkmk. If by default access is:

https:\\<server_name>\<site>

I wish it could also be accessed by

https:\\<server_name>\<anything>\<site>

Is this possible? How?

Thank you!!!

Should be possible.
The request is handled by the system apache. You could add a redirect/rewrite/proxypass/… there, depending on your specific needs.

Have a look at the following files (on a Debian Checkmk server) to help understand how the requests for /SITENAME are handled:

/etc/apache2/conf-enabled/zzz_omd.conf 
/opt/omd/apache/SITENAME.conf 
/omd/sites/SITENAME/etc/apache/mode.conf
/omd/sites/SITENAME/etc/apache/proxy-port.conf

(btw, it’s forward slashes /, not backslashes \, of course)

thanks @martin.schwarz, i’ll try this.

I’m doing something related, namely rewriting https://server.example.com/ to https://server.example.com/sitename/ for the “default” site on this server
(instead of the Apache2 Debian default page “It works”)

Simple config snippet inside /etc/apache2/sites-enabled/default-ssl.conf:

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                [...]

                # redirect to Checkmk site:
                <IfModule mod_alias.c>
                        RedirectMatch permanent ^/$ /sitename/
                </IfModule>

                [...]

Thanks @martin.schwarz

Maybe this can help you, it’s another alternative. My server is a Centos7.

In a file at /omd/apache/cmk_mysite.conf

Include /omd/sites/cmk_mysite/etc/apache/mode.conf
RewriteEngine On
RewriteCond %{HTTPS}  !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
<VirtualHost *:443>
  ServerName myserver.org
  ServerAlias myserver
  Redirect / https://myserver.org/cmk_mysite/
</VirtualHost>
<VirtualHost *:443>
  ServerName app.myserver.org
  ServerAlias app.myserver app.myserver.org
  Redirect / https://myserver.org/cmk_mysite/check_mk/login.py?_origtarget=%2Fcmk_mysite%2Fnagvis%2Ffrontend%2Fnagvis-js%2Findex.php%3Fmod%3DMap%26act%3Dview%26show%3Dapp_status&_username=nagvis&_password=MYPASSWORD_login=1
</VirtualHost>

This redirects myserver.org and myserver to https://myserver.org/cmk_mysite.
And it also redirects the subdomain to a nagvis map.

I’m still investigating how to make the URL not change and always show as:
https://my_domain/some1/some2/cmk_mysite

I guess you can set up the system apache as a reverse proxy with mod_proxy so any client request to /some1/some2/cmk_mysite will be answered with the contents apache fetches internally from /cmk_mysite

hello @martin.schwarz,

thank you very much for your help. I have tried to use the proxypass but I am stopped at a point. I have written it in this other post.

greeting