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()
This problem occurs because the port is occupied, which means that the current port 80 is occupied.
Solution:
(1) View the port
sudo netstat -ntlp
You must add sudo, otherwise you can not see the process id and process name
(2) find the port corresponding to 80, and kill the process
sudo kill 进程id
Run sudo netstat -ntlp to see if 80 is killed (3) Start nginx
sudo nginx
(4) Check whether the startup is successful: sudo netstat -ntlp
problem solving class