Hello:
Recently when I was testing my website, I found that whenever my server was restarted, my website would report an error 404 NOT FOUND. So I checked the errors one by one and found the following problem:
polariss@ser27934662404:~$ sudo lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 910 root 6u IPv4 22239 0t0 TCP *:http (LISTEN)
nginx 910 root 7u IPv6 22240 0t0 TCP *:http (LISTEN)
nginx 911 www-data 6u IPv4 22239 0t0 TCP *:http (LISTEN)
nginx 911 www-data 7u IPv6 22240 0t0 TCP *:http (LISTEN)
nginx 912 www-data 6u IPv4 22239 0t0 TCP *:http (LISTEN)
nginx 912 www-data 7u IPv6 22240 0t0 TCP *:http (LISTEN)
nginx 914 www-data 6u IPv4 22239 0t0 TCP *:http (LISTEN)
nginx 914 www-data 7u IPv6 22240 0t0 TCP *:http (LISTEN)
nginx 915 www-data 6u IPv4 22239 0t0 TCP *:http (LISTEN)
nginx 915 www-data 7u IPv6 22240 0t0 TCP *:http (LISTEN)
My port 80 was occupied by both IPV4 and IPV6 nginx processes, so I killed all the processes on port 80 and checked again:
polariss@ser27934662404:~$ sudo fuser -k 80/tcp
80/tcp: 910 911 912 914 915
polariss@ser27934662404:~$ sudo lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 2517 root 26u IPv4 41385 0t0 TCP *:http (LISTEN)
nginx 2518 www 26u IPv4 41385 0t0 TCP *:http (LISTEN)
nginx 2519 www 26u IPv4 41385 0t0 TCP *:http (LISTEN)
nginx 2520 www 26u IPv4 41385 0t0 TCP *:http (LISTEN)
nginx 2521 www 26u IPv4 41385 0t0 TCP *:http (LISTEN)
At this point, my website has returned to normal access, but I have to perform the above steps every time I restart the server. I want to know how I can completely solve it.
Best.
polariss