Change Webroot on CentOS

Hi all,

I have searched on google and on the forums but I can not find a clear answer as to how i can set my default page to point to checkmk site.

I am running check_mk v2.0.0p18 on CentOS8.
Currently my url is http://192.168.0.1/mysite
My goal is that when i use the url http://192.168.0.1 that it lands on the mysite login page.

Can anyone point me towards the right direction?

Best Regards,

Guy

Thats how we do it with https:

[root@deaugmon0242 ~]# cat /etc/httpd/conf.d/rewrite.conf
RewriteEngine on
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RedirectMatch 302 "^/$" "/mysite/"
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
#LogLevel alert rewrite:trace6

4 Likes

Hi Mike,

I tried the following

[root@srv-vlcc-mon ~]# cat /etc/httpd/conf.d/rewrite.conf
RewriteEngine on
RewriteCond %{HTTP} !on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
RedirectMatch 302 "^/$" "/mysite/"
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]

But httpd does not want to restart after this code.

Best Regards,

Guy

My you try:

httpd -f /etc/httpd/conf/httpd.conf -t

You need to make sure the required module “mod_rewrite” is enabled/loaded.

On Debian-based systems, one would run “sudo a2enmod rewrite” which creates a symlink “/etc/apache2/mods-enabled/rewrite.load” pointing to “…/mods-available/rewrite.load”

Not sure if CentOS has a similar abstraction or if you just have to create such a link yourself (or even manually issue the corresponding “LoadModule …” directive in some config file).

mod_rewrite should be already installed with httpd.
You may check:

[root@deaugwuxl0666 ~]# httpd -M | grep rew
 rewrite_module (shared)

In case of SSL mod_ssl needs to be installed.

Hi Mike,

[root@srv-vlcc-mon ~]# httpd -f /etc/httpd/conf/httpd.conf -t
Syntax OK

I can get httpd starting but when i enter the url I get this reply

ERR_TOO_MANY_REDIRECTS

Best Regards,

Guy

In case you dont want to use HTTPS the following two lines makes no sense:

RewriteCond %{HTTP} !on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

You are already on HTTP so it makes no sense to rewrite the URL.

Thanks @mike1098, that solved the issue for me!

Welcome. Please mark it as solution