环境
系统: 阿里云Ubuntu18.04 TLS nginx版本: 1.14.0
问题描述
出于某些原因,nginx来来回回装了好几遍,最后出现的这个报错: Failed to start A high performance web server and a reverse proxy server
完整报错信息如下:
$ systemctl status nginx
* nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2022-03-14 20:59:24 CST; 3min 22s ago
Docs: man:nginx(8)
Main PID: 17851 (code=exited, status=0/SUCCESS)
Mar 14 20:59:23 aliyum nginx[25077]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Mar 14 20:59:23 aliyum nginx[25077]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Mar 14 20:59:23 aliyum nginx[25077]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Mar 14 20:59:23 aliyum nginx[25077]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Mar 14 20:59:24 aliyum nginx[25077]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Mar 14 20:59:24 aliyum nginx[25077]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Mar 14 20:59:24 aliyum nginx[25077]: nginx: [emerg] still could not bind()
Mar 14 20:59:24 aliyum systemd[1]: nginx.service: Control process exited, code=exited status=1
Mar 14 20:59:24 aliyum systemd[1]: nginx.service: Failed with result 'exit-code'.
Mar 14 20:59:24 aliyum systemd[1]: Failed to start A high performance web server and a reverse proxy server.
解决
一开始重装的时候没有出现这个报错,重装了几次才出现的。一开始的时候还以为重装时卸载不干净造成的。 最后发现 虽然nginx卸载了,但是依然有正在运行的nginx实例 可以查看下端口占用:
netstat -apn | grep 80
所以答案就出来了:把进程杀掉就可以了,连重装都不用重装
|