Good morning, In /var/log/monit.log i have the following Lines: Code: [2025-12-11T08:29:24+0000] error : 'nginx' failed protocol test [DEFAULT] at [localhost]:443 [TCP/IP] -- Connection refused [2025-12-11T08:29:24+0000] info : 'nginx' trying to restart [2025-12-11T08:29:24+0000] info : 'nginx' stop: '/usr/bin/systemctl stop nginx' [2025-12-11T08:29:24+0000] info : 'nginx' start: '/usr/bin/systemctl start nginx' [2025-12-11T08:31:24+0000] error : 'nginx' failed protocol test [DEFAULT] at [localhost]:443 [TCP/IP] -- Connection refused [2025-12-11T08:31:24+0000] info : 'nginx' trying to restart [2025-12-11T08:31:24+0000] info : 'nginx' stop: '/usr/bin/systemctl stop nginx' [2025-12-11T08:31:25+0000] info : 'nginx' start: '/usr/bin/systemctl start nginx' [2025-12-11T08:33:25+0000] error : 'nginx' failed protocol test [DEFAULT] at [localhost]:443 [TCP/IP] -- Connection refused [2025-12-11T08:33:25+0000] info : 'nginx' trying to restart [2025-12-11T08:33:25+0000] info : 'nginx' stop: '/usr/bin/systemctl stop nginx' [2025-12-11T08:33:26+0000] info : 'nginx' start: '/usr/bin/systemctl start nginx' [2025-12-11T08:35:26+0000] error : 'nginx' failed protocol test [DEFAULT] at [localhost]:443 [TCP/IP] -- Connection refused [2025-12-11T08:35:26+0000] info : 'nginx' trying to restart [2025-12-11T08:35:26+0000] info : 'nginx' stop: '/usr/bin/systemctl stop nginx' [2025-12-11T08:35:27+0000] info : 'nginx' start: '/usr/bin/systemctl start nginx' [2025-12-11T08:37:27+0000] error : 'nginx' failed protocol test [DEFAULT] at [localhost]:443 [TCP/IP] -- Connection refused [2025-12-11T08:37:27+0000] info : 'nginx' trying to restart [2025-12-11T08:37:27+0000] info : 'nginx' stop: '/usr/bin/systemctl stop nginx' [2025-12-11T08:37:27+0000] info : 'nginx' start: '/usr/bin/systemctl start nginx' What do I need to do to successfully test [localhost]:443?
This is my Monit config for Nginx, which works like a charm Code: check process nginx with pidfile /var/run/nginx.pid group nginx start program = "/usr/bin/systemctl start nginx" with timeout 60 seconds stop program = "/usr/bin/systemctl stop nginx" if failed port 80 protocol http then restart if failed port 443 protocol https then restart if 5 restarts within 5 cycles then timeout depend nginx_bin check file nginx_bin with path /usr/sbin/nginx group nginx include /etc/monit/templates/rootbin
Thanks for your reply. I using the default configuration, that was created by the installer script: /etc/monit/conf-enabled/nginx Code: check process nginx with pidfile /var/run/nginx.pid group nginx start program = "/usr/bin/systemctl start nginx" with timeout 60 seconds stop program = "/usr/bin/systemctl stop nginx" if failed port 80 protocol http then restart if failed port 443 then restart if 5 restarts within 5 cycles then timeout depend nginx_bin check file nginx_bin with path /usr/sbin/nginx group nginx include /etc/monit/templates/rootbin If i adding if failed port 443 protocol https then restart: Code: check process nginx with pidfile /var/run/nginx.pid group nginx start program = "/usr/bin/systemctl start nginx" with timeout 60 seconds stop program = "/usr/bin/systemctl stop nginx" if failed port 80 protocol http then restart if failed port 443 protocol https then restart if 5 restarts within 5 cycles then timeout depend nginx_bin check file nginx_bin with path /usr/sbin/nginx group nginx include /etc/monit/templates/rootbin The Problem still exists, NGINX restarts every 2 Minutes: Code: [2025-12-11T12:58:46+0000] error : 'nginx' failed protocol test [HTTP] at [localhost]:443 [TCP/IP TLS] -- Connection refused [2025-12-11T12:58:46+0000] info : 'nginx' trying to restart [2025-12-11T12:58:46+0000] info : 'nginx' stop: '/usr/bin/systemctl stop nginx' [2025-12-11T12:58:46+0000] info : 'nginx' start: '/usr/bin/systemctl start nginx' [2025-12-11T13:00:46+0000] error : 'nginx' failed protocol test [HTTP] at [localhost]:443 [TCP/IP TLS] -- Connection refused [2025-12-11T13:00:46+0000] info : 'nginx' trying to restart [2025-12-11T13:00:46+0000] info : 'nginx' stop: '/usr/bin/systemctl stop nginx' [2025-12-11T13:00:47+0000] info : 'nginx' start: '/usr/bin/systemctl start nginx'
Have you checked if your Nginx listens on port 443 at all? Maybe you have no SSL-enabled website or you use a different port?
I have just checked all websites. SSL is active everywhere. It is either a self-signed certificate (created by ISPconfig) or a LetsEncrypt certificate. In addition, SSL runs on port 443 for all websites.
It is obvious that monit cannot connect to locahost on port 443. In the logs "Connection refused" says it all. Question is why monit cannot connect. My guess is some kind of firewall issue. Try it with a simple telnet from te command line and see what happens than Code: telnet localhost 443
have any of the nginx system files been updated?, if monit is also monitoring the checksum of the nginx files and they've been changed then that could fail as well. maybe (assuming you're sure everything has been safely updated and no files have been maliciously altered) try rkhunter --propupd systemctl reload monit and then check the monit status page for nginx, you may need to select the bin file and select 'enable monitoring' again
I found the problem. NGINX was only listening on port 443 for the configured domains. To make NGINX listen on *:443, I had to configure the IP * for one website. Without this setting, ISPconfig does not create the following configurations in the NGINX configuration: listen *:443 ssl http2; listen [::]:443 ssl http2;