death114 发表于 2018-11-25 09:59:52

apache重启报错:Address already in use: make_sock: could not bind to address的解决

  今天配置了apache的多虚拟主机,基于端口的,基于IP的,基于域名的,都配置了,这些测试也成功。
  之后,就接着配置多虚拟主机的mod_expires,关于mod_expires的文件就不贴在这里了,网上很多,类似的。
  可是配置了之后,对apache进行apache优雅重启,但是报错如下:


[*]# /application/apache2.2.23/bin/apachectl graceful
[*]httpd not running, trying to start
[*](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

  仔细检查,没发现配置方面的错误,包括主配置文件,虚拟机配置文件都正确。
  报错信息的提示是,端口已经在使用了,不能绑定到指定的端口上。
  仔细想想,已经有apache在启动了,用ps查进程,再杀掉。


[*]# ps -ef | grep httpd
[*]root      367728780 18:35 pts/1    00:00:00 grep httpd
[*]root      5536   10 10:44 ?      00:00:00 /application/apache2.2.23/bin/httpd -k start
[*]daemon   1020355360 11:45 ?      00:00:00 /application/apache2.2.23/bin/httpd -k start
[*]daemon   1020455360 11:45 ?      00:00:00 /application/apache2.2.23/bin/httpd -k start
[*]daemon   1020655360 11:45 ?      00:00:00 /application/apache2.2.23/bin/httpd -k start
[*]daemon   1020855360 11:45 ?      00:00:00 /application/apache2.2.23/bin/httpd -k start
[*]daemon   1030055360 11:46 ?      00:00:00 /application/apache2.2.23/bin/httpd -k start
[*]# killall httpd
#
#

  再进行apache优雅重启,正常了,测试mod_expires(可以看到,已经为html文件生成缓存了),OK。


[*]# curl -I 192.168.88.128:8081
[*]HTTP/1.1 200 OK
[*]Date: Sun, 02 Dec 2012 10:41:04 GMT
[*]Server: Apache/2.2.23 (Unix) DAV/2
[*]Last-Modified: Sun, 02 Dec 2012 03:10:51 GMT
[*]ETag: "2d802d-63-4cfd5fae2e4c0"
[*]Accept-Ranges: bytes
[*]Content-Length: 99
[*]Cache-Control: max-age=31104000
[*]Expires: Wed, 27 Nov 2013 10:41:04 GMT
[*]Content-Type: text/html




页: [1]
查看完整版本: apache重启报错:Address already in use: make_sock: could not bind to address的解决