![Amazon EC2-启动端口 80 上出现 httpd 错误-(98)地址已在使用中:make_sock](https://linux22.com/image/639276/Amazon%20EC2-%E5%90%AF%E5%8A%A8%E7%AB%AF%E5%8F%A3%2080%20%E4%B8%8A%E5%87%BA%E7%8E%B0%20httpd%20%E9%94%99%E8%AF%AF-%EF%BC%8898%EF%BC%89%E5%9C%B0%E5%9D%80%E5%B7%B2%E5%9C%A8%E4%BD%BF%E7%94%A8%E4%B8%AD%EF%BC%9Amake_sock.png)
我无法在我的 AWS Linux 实例上运行 httpd。
每当我尝试启动该服务时,我都会收到以下错误。
$ service httpd start
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
我尝试了所有能想到的方法。
- 检查端口 80,但没有显示任何正在运行的进程
$ netstat -tulpn | grep :80
(No info could be read for "-p": geteuid()=222 but you should be root.)
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 :::8080 :::* LISTEN -
tcp 0 0 :::80 :::* LISTEN -
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN -
tcp 0 0 :::8009 :::* LISTEN -
-检查是否有其他条目监听端口 80
$ grep -r Listen /etc/httpd
/etc/httpd/conf/httpd.conf:# Listen: Allows you to ...
/etc/httpd/conf/httpd.conf:# Change this to Listen ...
/etc/httpd/conf/httpd.conf:#Listen 12.34.56.78:80
/etc/httpd/conf/httpd.conf:Listen 80
-尝试卸载,并使用 yum 安装程序重新安装
我对 Linux 和服务器设置还不太熟悉,所以如果我遗漏了一些简单的东西,我深表歉意。有什么想法吗?
编辑:哎呀,我在端口 80 上运行了 ssh。谢谢大家
答案1
您的netstat -tulpn | grep :80
命令清楚地表明您有一个已经在端口 80 上监听的服务:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 :::80 :::* LISTEN -
通过运行以下命令识别此服务:
sudo netstat -anp | grep :80
然后,终止/停止该服务并重新启动httpd
。