Thursday, May 14, 2015

Cacti web access redirect from http to https

By default cacti can access using both http and https traffic. But due to the security reasons it should recommended to access cacti via https. Therefore you should change the index.php which is located in /usr/share/cacti folder.

So here is the tip on how to deploy in your Linux Machine:

1. Edit the index.php located on cacti's root folder
#cd /usr/share/cacti
#vi index.php

copy the PHP code below and insert it on the first line of index.php

<?php
if ($_SERVER['SERVER_PORT']!=443)
{
$url = "https://". $_SERVER['SERVER_NAME'] . ":443".$_SERVER['REQUEST_URI'];
header("Location: $url");
}
?>

Then restart the apache server.
Open your cacti using http://your-server-ip/cacti, this will redirect you to https://your-server-ip/cacti and ask you to verify and confirm web certificate on the first use. Just proceed and complete the process and you are good to go.

No comments:

Post a Comment