Nginx redirect http https Problem


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;


return 301 https://$server_name$request_uri;


server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include snippets/;
include snippets/ssl-params.conf;
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;


Assuming the URL in your config is the one you are trying and it’s not firewalled off, port 80 isn’t responding.

1 Like

Hi thanks for the help but the port 80 is open in the server

22/tcp open ssh
80/tcp open http
443/tcp open https

Maybe but you obviously have a firewall in front of it so I’d check that.

1 Like
  1. I managed to solve the problem there was a firewall rule in one of our routers that prevented communication between port 80 I’m sorry I was stubborn @laf thanks for the help
1 Like

No need to apologise :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.