nginx启动问题

错误提示

nginx: [emerg] unknown log format "main" in /usr/local/nginx-1.5.1/conf/nginx.conf:38

解决办法
删除nginx.conf中log_format前面的注释符号#即可
log_format

错误提示

[root@ZabbixServer conf]# /usr/local/nginx-1.5.1/sbin/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()

解决办法
查看80端口的占用情况

[root@ZabbixServer conf]# lsof -i:80
COMMAND    PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
clock-app 3192   acer   22u  IPv4 175347      0t0  TCP 192.168.1.220:42015->a104-75-169-104.deploy.static.akamaitechnologies.com:http (ESTABLISHED)
nginx     8356   root    7u  IPv4 173078      0t0  TCP *:http (LISTEN)
nginx     8357 nobody    7u  IPv4 173078      0t0  TCP *:http (LISTEN)

发现已经有nginx进程占用了80端口,将占用80端口的进程结束了,即可正常运行nginx

[root@ZabbixServer conf]# kill 8356
[root@ZabbixServer conf]# kill 8357
bash: kill: (8357) - 没有那个进程
[root@ZabbixServer conf]# lsof -i:80
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
clock-app 3192 acer   22u  IPv4 175347      0t0  TCP 192.168.1.220:42015->104.75.169.104:http (CLOSE_WAIT)
[root@ZabbixServer conf]# /usr/local/nginx-1.5.1/sbin/nginx
[root@ZabbixServer conf]# 

你可能感兴趣的:(运维)