Nginx 错误处理方法: bind() to 0.0.0.0:80 failed

本文介绍了解决Nginx在Windows上启动时遇到80端口被占用的问题,通过查找并终止占用80端口的进程,如Apache的httpd,最终成功启动Nginx。

启动window上的nginx总是报错

转自:http://blog.youkuaiyun.com/zero_295813128/article/details/50914233

错误信息是bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)

大概意思是 nginx listen的80后端口被占用   于是百度了下查看端口的命令

运行–cmd

C:\>netstat -aon|findstr "80" 
TCP 127.0.0.1:80 0.0.0.0:0 LISTENING 2448

端口被进程号为2448的进程占用,继续执行下面命令:
C:\>tasklist|findstr "2448" 

thread.exe 2016 Console 0 16,064 K
很清楚,thread占用了你的端口,Kill it
如果第二步查不到,那就开任务管理器,进程—查看—选择列—pid(进程位标识符)打个勾就可以了
看哪个进程是2448,然后杀之即可。

另外,强制终止进程: CMD命令:taskkill /F /pid 1408

其实上面我都还没解决问题 最后发现有个http.d 这个是apache的进程 结束了这个进程nginx才启动了

转载于:https://www.cnblogs.com/lojun/p/8479272.html

[root@localhost ~]# systemctl status nginx.service ● nginx.service - nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since 四 2025-09-18 09:19:57 CST; 53s ago Docs: http://nginx.org/en/docs/ Process: 14473 ExecStop=/bin/sh -c /bin/kill -s TERM $(/bin/cat /var/run/nginx.pid) (code=exited, status=1/FAILURE) Process: 13795 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE) Main PID: 18097 (code=exited, status=0/SUCCESS) 9月 18 09:19:55 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:9999 fail...e) 9月 18 09:19:56 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:80 failed...e) 9月 18 09:19:56 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:9999 fail...e) 9月 18 09:19:56 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:80 failed...e) 9月 18 09:19:56 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:9999 fail...e) 9月 18 09:19:57 localhost.localdomain nginx[13795]: nginx: [emerg] still could not bind() 9月 18 09:19:57 localhost.localdomain systemd[1]: nginx.service: control process exited, code=...=1 9月 18 09:19:57 localhost.localdomain systemd[1]: Failed to start nginx - high performance web...r. 9月 18 09:19:57 localhost.localdomain systemd[1]: Unit nginx.service entered failed state. 9月 18 09:19:57 localhost.localdomain systemd[1]: nginx.service failed. Hint: Some lines were ellipsized, use -l to show in full. [root@localhost ~]# journalctl -xe -- Unit session-2720.scope has finished starting up. -- -- The start-up result is done. 9月 18 09:19:13 localhost.localdomain sshd[13657]: pam_unix(sshd:session): session opened for user r 9月 18 09:19:54 localhost.localdomain polkitd[1191]: Registered Authentication Agent for unix-proces 9月 18 09:19:54 localhost.localdomain systemd[1]: Starting nginx - high performance web server... -- Subject: Unit nginx.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit nginx.service has begun starting up. 9月 18 09:19:54 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: 9月 18 09:19:54 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:9999 failed (98 9月 18 09:19:55 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: 9月 18 09:19:55 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:9999 failed (98 9月 18 09:19:55 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: 9月 18 09:19:55 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:9999 failed (98 9月 18 09:19:56 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: 9月 18 09:19:56 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:9999 failed (98 9月 18 09:19:56 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: 9月 18 09:19:56 localhost.localdomain nginx[13795]: nginx: [emerg] bind() to 0.0.0.0:9999 failed (98 9月 18 09:19:57 localhost.localdomain nginx[13795]: nginx: [emerg] still could not bind() 9月 18 09:19:57 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited 9月 18 09:19:57 localhost.localdomain systemd[1]: Failed to start nginx - high performance web serve -- Subject: Unit nginx.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit nginx.service has failed. -- -- The result is failed. 9月 18 09:19:57 localhost.localdomain polkitd[1191]: Unregistered Authentication Agent for unix-proc 9月 18 09:19:57 localhost.localdomain systemd[1]: Unit nginx.service entered failed state. 9月 18 09:19:57 localhost.localdomain systemd[1]: nginx.service failed.
最新发布
09-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值