Debain view port occupies open port

View specified port services

Check which services are occupied by 3002:sudo lsof -i :3002

Close the specified service:kill PID

open port

edit file:vi /etc/nftables.conf

The modified content is as follows

#!/usr/sbin/nft -f

flush ruleset

table inet filter {
        chain input {
                type filter hook input priority 0;
                ###在下面增加你需要开放的端口###
                tcp dport 1002 accept
                tcp dport 3000 accept
                ###在上面增加你需要开放的端口###
        }
        chain forward {
                type filter hook forward priority 0;
        }
        chain output {
                type filter hook output priority 0;
        }
}

Restart the service:systemctl restart nftables

How to stop a python service

View process services:
ps aux | grep python

ps -ef | grep python

lsof -i :3002

netstat -nlpt | grep nginx

Close the specified service:kill PID

Guess you like

Origin blog.csdn.net/the_liang/article/details/129849297