[英]Apache can't start “could not bind to address [::]:443” though no process is using it, and netcat can openit
[英]Apache cannot bind :443 address for SSL even though port 443 is unused
我最近使用 openssl 1.0.2j 安装了启用 SSL 的 Apache 2.4.20。
更新 httpd.conf 和 httpd-ssl.conf 文件并尝试在侦听端口 443 的同时启动 Apache 后,出现以下错误:
(13)Permission denied: -----: make_sock: could not bind to address [::]:443
(13)Permission denied: -----: make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down
这是我的配置:
httpd.conf:
Listen 51000
#Listen 443
#Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
httpd-ssl.conf
Listen 443
如果我在 httpd-ssl.conf 文件中注释掉这一行,我的 apache 就可以正常启动:
attempting to start apache
done
但是有了它,我每次都会收到套接字错误。
我以 root 身份运行以下命令:
netstat -tlpn | grep :443
什么都没回。
lsof -i tcp:443
什么都没回。
我在某处读到只有 root 可以绑定到 1024 以下的地址,但我不知道该声明的有效性。 Apache 没有在此处以 root 身份运行 - 这会是问题吗?
如果您将 docker 与 docker-compose 一起使用,
当我们使用像bitnami官方镜像这样的非根容器时会发生这种情况。
当需要与主机网络绑定时,我们使用了user:root和network_mode: host 。
apache:
image: bitnami/apache:2.4
container_name: "apache"
ports:
- 80:80
network_mode: host
privileged: true
user: root
environment:
DOCKER_HOST: "unix:///var/run/docker.sock"
env_file:
- .env
volumes:
- ./setup/apache/httpd.conf:/opt/bitnami/apache/conf/httpd.conf
希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.