背景
报错信息: fatal: [master]: FAILED! => {“changed”: true, “cmd”: “cd /usr/local/nginx/sbin\n./nginx”, “delta”: “0:00:02.508330”, “end”: “2024-05-14 15:24:46.937610”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2024-05-14 15:24:44.429280”, “stderr”: “nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)\nnginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)\nnginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)\nnginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)\nnginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)\nnginx: [emerg] still could not bind()”, “stderr_lines”: [“nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)”, “nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)”, “nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)”, “nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)”, “nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)”, “nginx: [emerg] still could not bind()”], “stdout”: “”, “stdout_lines”: []}
一、步骤
1.查看端口是否被占用
代码如下(示例):
netstat -nltp |grep nginx
2.杀掉nginx进程
kill -9 进程号