Change apache landing page to directly launch Cacti

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
shonaran
Cacti User
Posts: 59
Joined: Thu May 04, 2017 8:49 am

Change apache landing page to directly launch Cacti

Post by shonaran »

How can I change the apache landing page so the user does not have to add /cacti at the end of the URL to launch Cacti in RHEL?

Currently, user has to type https://server-name/cacti

I would like this to be: https://server-name

In /etc/httpd/conf/cacti.conf, I have the alias /cacti pointing to /usr/share/cacti

How do I change this to be the document root? The current DocumentRoot in /etc/httpd/conf/httpd.conf points to "DocumentRoot "/var/www/html""
shonaran
Cacti User
Posts: 59
Joined: Thu May 04, 2017 8:49 am

Re: Change apache landing page to directly launch Cacti

Post by shonaran »

I just figured this out. For the benefit of others, I changed the DocumentRoot in /etc/httpd/conf/httpd.conf to /usr/share/cacti and this worked.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Change apache landing page to directly launch Cacti

Post by netniV »

You also need to update config.php so that it has the correct base uri.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
User avatar
camerabob
Cacti User
Posts: 386
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: Change apache landing page to directly launch Cacti

Post by camerabob »

You could alternately just create an index.html file in the current root that will automatically redirect the browser to cacti:

<html lang=en>
<head>
<TITLE>New page location</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://<base URL location>/cacti">
</head>
</html>
Prod: Cacti 1.2.15 @ CentOS Linux release 7.9.2009 (Core) & PHP 5.4.16-48.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Temp: Cacti 1.2.3 @ CentOS Linux release 7.9.2009 (Core) & PHP 5.4.16-48.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Router Configs @ 1.3.4
Syslog Monitoring @ 2.1
Thold @ 1.2.4
Ruslan777
Posts: 2
Joined: Mon Nov 08, 2021 11:19 pm

Re: Change apache landing page to directly launch Cacti

Post by Ruslan777 »

Hello!
i faced the same problem trying to change
/etc/apache2/sites-available/000-default.conf -> DocumentRoot /var/www/html on DocumentRoot /opt/cacti

/etc/apache2/sites-available/cacti.conf
Alias /cacti /opt/cacti

<Directory /opt/cacti>
Options +FollowSymLinks
AllowOverride None
<IfVersion >= 2.3>
Require all granted
</IfVersion>
<IfVersion < 2.3>
Order Allow,Deny
Allow from all
</IfVersion>

AddType application/x-httpd-php .php

<IfModule mod_php.c>
php_flag magic_quotes_gpc Off
php_flag short_open_tag On
php_flag register_globals Off
php_flag register_argc_argv On
php_flag track_vars On
php_value mbstring.func_overload 0
php_value include_path .
</IfModule>

DirectoryIndex index.php
</Directory>

I would like the cacti would available via direct link https://server-name , without an additional Alias and I can't authenticate to the cacti
User avatar
macan
Cacti Guru User
Posts: 1106
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Change apache landing page to directly launch Cacti

Post by macan »

Ruslan777 wrote: Tue Nov 09, 2021 12:08 am Hello!
i faced the same problem trying to change
/etc/apache2/sites-available/000-default.conf -> DocumentRoot /var/www/html on DocumentRoot /opt/cacti

/etc/apache2/sites-available/cacti.conf
Alias /cacti /opt/cacti

<Directory /opt/cacti>
Options +FollowSymLinks
AllowOverride None
<IfVersion >= 2.3>
Require all granted
</IfVersion>
<IfVersion < 2.3>
Order Allow,Deny
Allow from all
</IfVersion>

AddType application/x-httpd-php .php

<IfModule mod_php.c>
php_flag magic_quotes_gpc Off
php_flag short_open_tag On
php_flag register_globals Off
php_flag register_argc_argv On
php_flag track_vars On
php_value mbstring.func_overload 0
php_value include_path .
</IfModule>

DirectoryIndex index.php
</Directory>

I would like the cacti would available via direct link https://server-name , without an additional Alias and I can't authenticate to the cacti
<cacti instalation>/include/config.php:

/*
* Set the $url_path to point to the default URL of your cacti install.
* For exmaple if your cacti install as at `https://serverip/cacti/` this
* would be set to `/cacti/`.
*/

$url_path = '/';
Let the Cacti grow!
Ruslan777
Posts: 2
Joined: Mon Nov 08, 2021 11:19 pm

Re: Change apache landing page to directly launch Cacti

Post by Ruslan777 »

Thanks a lot @macan for your help!
It worked!

<cacti instalation>/include/config.php:

/*
* Set the $url_path to point to the default URL of your cacti install.
* For exmaple if your cacti install as at `https://serverip/cacti/` this
* would be set to `/cacti/`.
*/

$url_path = '/';
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests