标题说明了一切。我的问题:我重启了服务器,Apache 死机了,网站也瘫痪了。似乎 Apache 正在尝试绑定所有 IP... 但为什么呢?
如果我检查原因,则发出:service apache2 status
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2021-12-15 00:25:19 CET; 18s ago
Docs: https://httpd.apache.org/docs/2.4/
Dec 15 00:25:19 y systemd[1]: Starting The Apache HTTP Server...
Dec 15 00:25:19 y apachectl[563]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using [ipv6 addr]. Set the 'ServerN>
Dec 15 00:25:19 y apachectl[563]: (99)Cannot assign requested address: AH00072: make_sock: could not bind to address 1.2.3.4:80
Dec 15 00:25:19 y apachectl[563]: no listening sockets available, shutting down
Dec 15 00:25:19 y apachectl[563]: AH00015: Unable to open logs
Dec 15 00:25:19 y apachectl[549]: Action 'start' failed.
Dec 15 00:25:19 y apachectl[549]: The Apache error log may have more information.
Dec 15 00:25:19 y systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Dec 15 00:25:19 y systemd[1]: apache2.service: Failed with result 'exit-code'.
Dec 15 00:25:19 y systemd[1]: Failed to start The Apache HTTP Server.
- 操作系统是在服务器上运行的原始 Ubuntu 20.04.3 LTS。
- 该服务器有两个(ipv4)IP,我希望 Apache 只绑定到 1 个 ipv4。
/etc/apache2/ports.conf
仅包含以下内容:
Listen 1.2.3.4:80
<IfModule ssl_module>
Listen 1.2.3.4:443
</IfModule>
<IfModule mod_gnutls.c>
Listen 1.2.3.4:443
</IfModule>
每个 VirtualHost 仅包含:
<VirtualHost *:80>
</VirtualHost>
还有一个单独的 SSL 配置(由 Certbot ACME 自动创建)。