Hello,
I recently configured an ssl certificate for my librenms instance in nginx with cerbot I followed this colleague’s guide SSL for LibreNMS on Ubuntu 20.04 FULL How-to when I enter my https in the browser pointing to the domain of my librenms it opens but when I do it with http port 80 it does not redirect my config file looks pretty good i tried many things but nothing seems to work here is my nginx config file:
server {
listen 80;
listen [::]:80;
server_name librenms.osnetpr.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
server_name librenms.osnetpr.com;
root /opt/librenms/html;
index index.php;
access_log /opt/librenms/logs/access_log;
error_log /opt/librenms/logs/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;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /api/v0 {
try_files $uri $uri/ /api_v0.php?$query_string;
}
location ~ .php {
include fastcgi.conf;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm-librenms.sock;
}
location ~ /.ht {
deny all;
}
}