Reputation: 43
My server ip is internal (I dont have to publish it on internet) 192.168.251.4
I have a site in /opt/observium/html/ folder, I want to reach the site writing http://192.168.251.4/observium in browser.
I tried with virtual hosts without success.
OS: Ubuntu server 14.04LTS Apache versione: 2.4.7
Thank you!
Upvotes: 2
Views: 8318
Reputation: 43
Following covener answer I have too used the "Alias" Feature in apache but you also need to do another piece for the observium to make it work:
In Apache (based on ubuntu) I've added the file /etc/apache2/conf-available/observium.conf
:
<IfModule mod_alias.c>
Alias /observium /opt/observium/html/
</IfModule>
<Directory /opt/observium/html/>
Options FollowSymLinks
AllowOverride None
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
DirectoryIndex index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
Then activated the configuration (again this refers to ubuntu in RH variant it will be slightly different):
a2enconf observium
systemctl reload apache2
This will not work yet due to the fact that the observium expect to use the /
of the site as reference and you need to update that in /opt/observium/config.php
and add the folowing line:
$config['base_url'] = "http://" . $_SERVER["SERVER_NAME"] . ":".$_SERVER["SERVER_PORT"] . "/observium/";
(Please note the trailing /
)
Update: The process above missing one last change:
(Source: http://www.foobar.org/~nick/OBSERVIUM-11.html)
Edit the file /opt/observium/html/includes/functions.inc.php
and change the following line:
$segments = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
to:
$segments = explode('/', trim($_SERVER['PATH_INFO'], '/'));
Upvotes: 2
Reputation: 17886
It's a little odd that in the title you knew it was an "alias" but you didn't mention using the Alias directive.
Should be as simple as
Alias /observium /opt/observium/html
<Directory /opt/observium/html/>
Require all granted
</Directory>
Upvotes: 1