Janus provide an admin page for us to troubleshoot if a problem occur in our media server. But the page is not activated by default. This tutorial will show you how to enable the janus admin monitoring page.
Prerequisite
- Ubuntu 18.04
- Janus Installed, you can read this tutorial to help you install janus: How to Install Janus WebRTC Server on Ubuntu 18.04
- Janus Demo Page Activated, you can read this tutorial to help you configure and activating janus demo page: Basic Janus Configuration with SSL Enabled
Sudo Privileges
Before start we make sure that we will have no permission issue on the configuration.
sudo su
Janus HTTP Trasport Plugin Configuration
Open the janus http transport configuration
nano /opt/janus/etc/janus/janus.transport.http.jcfg
Go to admin
section in the configuration, and edit the configuration line this configuration bellow
admin_base_path = "/admin"
admin_http = true
admin_port = 7088
admin_https = false
Janus Core Configuration
Open the janus core configuration
nano /opt/janus/etc/janus/janus.jcfg
Find and edit this particular configuration
admin_secret = "<admin-password>"
The default password is janusoverlord
, don’t use the default password! Change <admin-password>
to use your own password.
Restart janus
service janus restart
Nginx Reverse Proxy Configuration
You must comply with the prerequisite no.3 to do this configuration. If you follow them, you already have Nginx reverse proxy.
Open the janus configuration
nano /etc/nginx/sites-available/janus
Add new location block next to the /janus
location block on your Nginx configuration
. . .
location /janus {
proxy_set_header Host $host;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://127.0.0.1:8088;
}
location /admin {
proxy_set_header Host $host;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://127.0.0.1:7088;
}
. . .
This configuration makes all request to /admin
uri will be proxied to port 7088
, where this port is the admin port we configure previously.
Make sure the nginx is configured correctly
nginx -t
Reload nginx
service nginx reload
Activate the Admin Monitoring Page
You must comply with the prerequisite no.3 to do this configuration.
Open the Admin page javascript file
nano /opt/janus/share/janus/demos/admin.js
Find this code:
var server = null;
if(window.location.protocol === 'http:')
server = "http://" + window.location.hostname + ":7088/admin";
else
server = "https://" + window.location.hostname + ":7889/admin";
Comment them all and change them to this:
var server = "https://<your.domain.com>/admin";
//if(window.location.protocol === 'http:')
// server = "http://" + window.location.hostname + ":7088/admin";
//else
// server = "https://" + window.location.hostname + ":7889/admin";
Change the <your.domain.com>
to match your janus api domain.
Accessing The Admin Monitoring Page
Open your browser and go to your janus demo page domain, click demos
menu and then click Admin/Monitor
sub menu. There will be a pop up form and fill them with <your.domain.com>/admin
and admin_secret
you already configure reviously.