小技巧:apache安装或者启动错误:AH00072: make_sock: could not bind to address [::]:443

参考链接链接

在windows下准备准备开启apache,发现端口被占用,看了host.conf里面配置的listen端口是80,但是提示是443,奇怪了,查了下资料,原来443是apache-ssl的端口。

C:\WINDOWS\system32>C:\Users\wesle\Desktop\httpd-2.4.41-o111c-x64-vc15-r2\Apache24\bin\httpd.exe -k install -n apache Installing the ‘apache’ service The ‘apache’ service is successfully installed. Testing httpd.conf…. Errors reported here must be corrected before the service can be started. (OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 : AH00072: make_sock: could not bind to address [::]:443 (OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 : AH00072: make_sock: could not bind to address 0.0.0.0:443 AH00451: no listening sockets available, shutting down AH00015: Unable to open logs

那就看看谁占用了443端口

  1. netstat -ano|findstr "443"

image.png
继续查7280这个进程号

  1. tasklist|findstr "7280"

image.png

可见433由vmare占用,然后打开“任务管理器”找到 vmare-hostd.exe这个进程关掉就可以。

PS:也可以不关掉vmare,那就解决apache了:
方案1:进入Apache的目录\Apache24\conf\extra,找到httpd-ahssl.conf和httpd-ssl.conf。寻找443替换成其他不常用的端口号,比如442。接下来就可以正常启动Apache了。

方案2:直接关闭Apache的SSL模块, 反正暂时还用不到,\xampp\apache\confhttpd.conf文件,注释171行#LoadModule ssl_module modules/mod_ssl.so 和539行#Include conf/extra/httpd-ssl.conf

命令

安装与配置Apache Http Sever 2.4

参考链接
本人将Apache24文件夹复制到E:/,并以管理员身份打开命令提示符,进入Apach24的bin目录。具体命令如下:

  1. >e:
  2. >cd Apache24
  3. >cd bin

首先修改Apache24/conf/httpd的配置文件:
找到以下内容,将 “/Apache24”修改为当前Apache24的目录,我的是E:\Apache24。(注意斜杆)

  1. Define SRVROOT “/Apache24
  2. ServerRoot ${SRVROOT}”

在命令提示符中输入以下命令,安装http service。(注意:命令中,Apache24为安装的服务名称,可以自行定义,比如apache

  1. >httpd.exe -k install -n "Apache24"

安装完成后可以通过win+R,输入services.msc,查看所有的服务。可以在服务中找到Apache24的服务。

启动Apache24 service

通过如下命令可以开启和关闭Apache24服务:(引号中的名字要与安装时的一样

  1. >httpd.exe -k start -n "Apache24"
  2. >httpd.exe -k stop -n "Apache24"

附: 重启和卸载http的命令

  1. >httpd.exe -k restart -n "Apache24"
  2. >httpd.exe -k uninstall -n "Apache24"

1、首先停掉apache服务,或者右击,选择属性,然后禁用服务(services.msc)
2、cmd命令行执行

  1. sc delete apache

修改端口号

对Apache默认网页服务端口号的修改后,一定记得要停止(STOP)一次Apache服务然后再启动(START),使刚刚的修改生效。但要注意的是,如果你修改了默认端口号(假如将Listen 80改为Listen 8080),那么你将无法通过http://localhost或者是http://127.0.0.1来打开位于Apache服务器上的网页,**必须在地址后面加上冒号+端口号,**如http://localhost:8080或者是http://127.0.0.1:8080,只有这样才能访问位于Apache服务器中的网页。