歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux服務器

Linux下Tomcat 80端口被占用的解決辦法

分析:netstat -an查看到大量的80端口進程僵死,重啟tomcat.tomcat啟動失敗,網頁依然無法打開.

停止tomcat進程shutdown.sh,停止tomcat後telnet 127.0.0.1 80,發現80端口依然可用。netstat -an|grep 80 查看發現有許多80端口進程在裡面,使用kill pid命令終止進程,無用。使用lsof -i :80|grep -v "PID"|awk '{print "kill -9",$2}'命令後所有80端口進程刪除。重新啟動tomcat,系統正常運行。不過為什麼tomcat在關閉時卻不能將80端口的進程一並關閉的原因需要分析一下。

[root@gzcourt bin]# netstat -an |grep 80
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LIST
EN
tcp 0 0 :::8009 :::* LIST
EN
tcp 0 0 :::80 :::* LIST
EN
tcp 0 0 :::8080 :::* LIST
EN
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:202.160.179.12:36057 TIME
_WAIT
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:202.160.178.15:39176 TIME
_WAIT
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:218.20.57.173:55001 ESTA
BLISHED
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:218.20.57.173:3516 ESTA
BLISHED
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:218.20.57.173:55037 ESTA
BLISHED
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:218.20.57.173:3518 ESTA
BLISHED
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:61.135.162.208:57893 TIME
_WAIT
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:210.72.4.122:39196 ESTA
BLISHED
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:59.32.124.136:22529 ESTA
BLISHED
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:218.20.57.173:55222 ESTA
BLISHED
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:218.20.57.173:3510 ESTA
BLISHED
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:59.32.124.136:22530 ESTA
BLISHED
tcp 0 0 ::ffff:172.16.1.153:80 ::ffff:210.72.4.122:39198 ESTA
BLISHED
unix 3 [ ] STREAM CONNECTED 6880 /tmp/.X11-unix/X0
# lsof -i :80|grep -v "PID"|awk '{print "kill -9",$2}'|sh
以上腳本可以清除80端口的進程

 

Copyright © Linux教程網 All Rights Reserved