绑定 Monit 以使用端口 443

Bind Monit to use Port 443

我正在使用此配置的 Monit:

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

我无法将端口更改为 443 或 80,但我只想在 443 上使用 https。 如果我尝试,我会收到此错误:

[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

如果 Apache 已在使用端口 443,您将无法侦听。

您应该将 Monit 绑定到另一个端口(例如 8443)。

如果您不想使用端口键入域,那也没关系。您应该看看来自 Apache 的 mod_proxy:https://httpd.apache.org/docs/trunk/mod/mod_proxy.html

基本上,让 Apache 在端口 443 上侦听 monit.example.com,并将这些请求转发到端口 8443 上的本地主机(Monit 实际上是 运行)。