anyway to change dashboard web port?

Having issues? Post them here, and help other users.
Post Reply
dony71
Junior Member
Posts: 6
Joined: Fri Oct 02, 2020 7:27 pm

anyway to change dashboard web port?

Post by dony71 »

I have already assign port 80 and port 443 in my network
Anyway to change dashboard web port?
dony71
Junior Member
Posts: 6
Joined: Fri Oct 02, 2020 7:27 pm

Re: anyway to change dashboard web port?

Post by dony71 »

I manage to figure out a bit
Under /etc/apache2/ports.conf, change "Listen 880" instead of "Listen 80" for changing port 80 to 880
Also under /etc/apache2/site-enabled/nems-dashboard.conf, change "<VirtualHost *:80>" to "<VirtualHost *:880>"
Now I can see dashboard at http://<nems-local-ip>:880
However link for NEMS server overview (https://<nems-local-ip>:880/info/) and NEMS system setting tools (https://<nems-local-ip>:880/config/) are still not correctly shown
Any further hints where to change ?
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

Re: anyway to change dashboard web port?

Post by Robbie Ferguson »

You should not be opening your NEMS Server to the world.

Knowing this, why would you need to change the port?

Robbie // The Bald Nerd
dony71
Junior Member
Posts: 6
Joined: Fri Oct 02, 2020 7:27 pm

Re: anyway to change dashboard web port?

Post by dony71 »

Robbie,
Like I said, I have other service on same server using port 80
If I don't change port, how I call nems dashboard?
stherien
Junior Member
Posts: 3
Joined: Sat Feb 08, 2020 8:50 am

Re: anyway to change dashboard web port?

Post by stherien »

Here are the steps to change the default port (443) for NEMS Web interface. As I need port 443 for other application (sparrow), so I changed it for port 8443

* I am currently running NEMS on Raspbery Pi 4 (Version 1.5.2)

1 ) Add port 8443 as listener to Apache2

sudo vi /etc/apache2/ports.conf

Where ever you see in file ports.conf
Listen 443
Add the following line underneath
Listen 8443

Example:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
Listen 443
Listen 8443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
Listen 8443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


2 ) Set port 8443 for NEMS Web interface

sudo vi /etc/apache2/sites-enabled/nems-dashboard.conf

Change 443
<VirtualHost *:443>
For 8443
<VirtualHost *:8443>

Example:

<VirtualHost *:8443>
ServerName www.nems.local
ServerAlias nems.local
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
# SSLCertificateChainFile /var/www/certs/ca.pem
</VirtualHost>


3 ) Ajuste header file to correct port number on Cockpit, RPi-Monitor, Webmin and monit Service Monitor

Cockpit-port.jpg
Cockpit-port.jpg (70.37 KiB) Viewed 7841 times

sudo vi /var/www/html/inc/header.php

At line 152, delete the 4 following lines

<?php if (ver('nems') >= 1.4 && ver('platform')->num != 21) echo '<li><a href="https://' . $self->host . ':9090" target="_blank">Cockpit</a></li>'; ?>
<?php if ((ver('platform')->num < 10) && checkConfEnabled('rpi-monitor')) { echo '<li><a href="http://' . $self->host . ':8888" target="_blank"> </a></li>'; } ?>
<?php if (ver('nems') <= 1.4 && checkConfEnabled('webmin')) { echo '<li><a href="https://' . $self->host . ':10000" target="_blank">Webmin</a></li>'; } ?>
<?php if (ver('nems') >= 1.3) echo '<li><a href="https://' . $self->host . ':2812" target="_blank"><em>monit</em> Service Monitor</a></li>'; ?>


Add the 6 following lines

<?php
$hostnoport = preg_replace('/(\:[0-9]+)$/', '', $self->host);
if (ver('nems') >= 1.4 && ver('platform')->num != 21) { echo '<li><a href="https://' . $hostnoport . ':9090" target="_blank">Cockpit</a></li>'; }
if ((ver('platform')->num < 10) && checkConfEnabled('rpi-monitor')) { echo '<li><a href="http://' . $hostnoport . ':8888" target="_blank">RPi-Monitor</a></li>'; }
if (ver('nems') <= 1.4 && checkConfEnabled('webmin')) { echo '<li><a href="https://' . $hostnoport . ':10000" target="_blank">Webmin</a></li>'; }
if (ver('nems') >= 1.3) echo '<li><a href="https://' . $hostnoport . ':2812" target="_blank"><em>monit</em> Service Monitor</a></li>';
?>


4) restart Apache2

sudo service apache2 restart

Enjoy !
Post Reply