Snips for LibreNMS Installation and Configuration
This is for configuring a purchased SSL Certificate for Librenms. If you don't have your own certificate from an authority, use the Certbot instructions for Nginx.
There is a full document HERE which you should follow first under the section "Nginx Config with Purchased SSL Cert"
When you get to Step #5, Use this code in your librenms.conf file. Be sure to replace "nms.example.com" with the name of your site.
server {
listen 80 default_server;
server_name _;
return 404;
}
server {
listen 443 ssl default_server;
server_name _;
ssl_certificate /etc/ssl/certs/example_bundle.crt;
ssl_certificate_key /etc/ssl/private/example.key;
return 404;
}
server {
listen 80;
server_name nms.example.com;
return 301 https://nms.example.com$request_uri;
}
server {
server_name nms.example.com;
root /opt/librenms/html;
index index.php;
access_log /var/log/nginx/librenms_access.log;
error_log /var/log/nginx/librenms_error.log;
charset utf-8;
gzip on;
gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/run/php-fpm-librenms.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
}
location ~ /\.(?!well-known).* {
deny all;
}
listen 443 ssl;
ssl_certificate /etc/ssl/certs/example_bundle.crt;
ssl_certificate_key /etc/ssl/private/example.key;
ssl_session_cache shared:le_nginx_SSL:10m;
ssl_session_timeout 1440m;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305; ssl_dhparam /etc/ssl/private/dhparams.pem;
add_header Strict-Transport-Security "max-age=63072000" always;
ssl_stapling on;
ssl_stapling_verify on;
resolver 1.1.1.1;
}
Test the config using
nginx -t
Reload the web server
systemctl restart nginx
Use the SNMP example and LibreNMS script located at:
https://wikisnips.com/en/Ubuntu#snmp-config
Use this WikiSnips Article: Oxidized for LibreNMS