Skip to content
Advertisement

Bind Monit to use Port 443 [closed]

I’m using Monit with this config:

set httpd port 2812
    allow 0.0.0.0/0.0.0.0
    allow md5 /etc/apache2/.htpasswd USERX
    ssl enable
    pemfile /etc/monit/pemfile-DOMAIN.pem

I can’t change to port to 443 nor 80 but I just want to use https on 443. I’m getting this error if I try:

[CEST Apr 26 23:08:33] error    : Cannot listen -- Address already in use
[CEST Apr 26 23:08:33] error    : HTTP server: not available -- could not create a server socket at port 443 -- Address already in use

Advertisement

Answer

You cannot listen on port 443 if already used by Apache.

You should bind Monit to another port (say, 8443).

If you don’t want to type the domain with the port, that’s fine. You should have a look at mod_proxy from Apache: https://httpd.apache.org/docs/trunk/mod/mod_proxy.html

Basically, make Apache listen for monit.example.com on port 443, and forward those requests to localhost on port 8443 (where Monit is actually running).

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement