View the nginx installation directory
[root@tang closer]# whereis nginx
nginx: /usr/local/nginx
Start nginx
[root@tang conf]# /usr/local/nginx/sbin/nginx
Port is occupied
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] bind() to 0.0.0.0:80 failed (98: Address already in use)
See which processes occupy port 80
[root@tang conf]# netstat -ltunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 32706/nginx: master
Kill the process
[root@tang conf]# kill -9 32706
Start nginx
[root@tang conf]# /usr/local/nginx/sbin/nginx