centos6.5,启动nginx服务,无法开启,导致网页打不开。把服务从起一下发现提示错误如下:
Starting nginx: 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)
nginx: [emerg] still could not bind()
问题描述:地址已被使用。可能nginx服务卡死了,导致端口占用,出现此错误。
查看端口
netstat -ntpl
[root@localhost /]# netstat -ntpl
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:58819 0.0.0.0:* LISTEN 2094/rpc.statd
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 5060/mysqld
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 2294/vsftpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2271/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2121/cupsd
tcp 0 0 :::23527 :::* LISTEN 2094/rpc.statd
tcp 0 0 :::80 :::* LISTEN 2347/httpd
tcp 0 0 :::22 :::* LISTEN 2271/sshd
tcp 0 0 ::1:631 :::* LISTEN 2121/cupsd
kill 2347
[root@localhost /]# service nginx start
Starting nginx: [ OK ]
[root@localhost /]# ps -ef|grep nginx
root 2816 1 0 11:03 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody 2817 2816 0 11:03 ? 00:00:00 nginx: worker process
nobody 2818 2816 0 11:03 ? 00:00:00 nginx: worker process
nobody 2819 2816 0 11:03 ? 00:00:00 nginx: worker process
nobody 2820 2816 0 11:03 ? 00:00:00 nginx: worker process
root 2823 2732 0 11:03 pts/0 00:00:00 grep nginx