![](/img/trans.png)
[英]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.