我遇到NGINX问题。我有3个系统(EC2)负载均衡(ELB)运行NGINX& PHP-FPM。在所有3个系统中,NGINX将神秘地崩溃。下面我在DEBUG模式中包含了一部分LOG。
在我通过日志之前,这是我关于可能发生的事情的理论,也许有人可以确认或提供一些我可以深入了解的更好的见解。从我在网上找到的; NGINX崩溃的一个主要原因是NFS共享的一个已知问题。当NGINX调用文件并且NFS引擎忙碌时,会发生这种情况' 阻止'。我可以确认我有大约6个NFS共享连接到这些系统。每个站点都有一个设置。这些共享仅包含必须是共享文件的相关目录,例如上载的图像和头像。
我在网上看到,使用的优化是设置NGINX使用' epoll '。虽然我没有在设置中直接说明它,但您可以在日志中看到它的使用。我还应该将设置添加到CONF文件吗? NFS共享是我的问题的根源吗?
谢谢,&非常感谢任何帮助。
这是NGINX -V:
nginx version: nginx/1.4.7
built by gcc 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC)
TLS SNI support enabled
configure arguments:
--prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--http-client-body-temp-path=/var/lib/nginx/tmp/client_body
--http-proxy-temp-path=/var/lib/nginx/tmp/proxy
--http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi
--http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi
--http-scgi-temp-path=/var/lib/nginx/tmp/scgi
--pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx
--user=nginx --group=nginx --with-file-aio --with-ipv6
--with-http_ssl_module --with-http_spdy_module
--with-http_realip_module --with-http_addition_module
--with-http_xslt_module --with-http_image_filter_module
--with-http_geoip_module --with-http_sub_module --with-http_dav_module
--with-http_flv_module --with-http_mp4_module --with-http_gunzip_module
--with-http_gzip_static_module --with-http_random_index_module
--with-http_secure_link_module --with-http_degradation_module
--with-http_stub_status_module --with-http_perl_module --with-mail
--with-mail_ssl_module --with-pcre --with-google_perftools_module
--with-debug
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
--with-ld-opt=' -Wl,-E'
以下是DEBUG信息:
2014/09/17 08:37:46 [debug] 2034#0: worker cycle
2014/09/17 08:37:46 [debug] 2034#0: epoll timer: 11605
2014/09/17 08:37:46 [debug] 2034#0: epoll: fd:69 ev:0005 d:0000000001632281
2014/09/17 08:37:46 [debug] 2034#0: timer delta: 0
2014/09/17 08:37:46 [debug] 2034#0: posted events 0000000001661460
2014/09/17 08:37:46 [debug] 2034#0: posted event 0000000001661460
2014/09/17 08:37:46 [debug] 2034#0: posted event 0000000000000000
2014/09/17 08:37:46 [debug] 2034#0: worker cycle
2014/09/17 08:37:46 [debug] 2034#0: epoll timer: 11605
2014/09/17 08:37:50 [debug] 2034#0: epoll: fd:51 ev:0005 d:0000000001631500
2014/09/17 08:37:50 [debug] 2034#0: *1 event timer del: 51: 1410964731764
2014/09/17 08:37:50 [debug] 2034#0: *1 http process request line
2014/09/17 08:37:50 [debug] 2034#0: *1 http request line: "GET /data/avatars/m/0/163.jpg HTTP/1.1"
2014/09/17 08:37:50 [debug] 2034#0: *1 http uri: "/data/avatars/m/0/163.jpg"
2014/09/17 08:37:50 [debug] 2034#0: *1 http args: ""
2014/09/17 08:37:50 [debug] 2034#0: *1 http exten: "jpg"
2014/09/17 08:37:50 [debug] 2034#0: *1 posix_memalign: 00000000014FA890:4096 @16
2014/09/17 08:37:50 [debug] 2034#0: *1 http process request header line
2014/09/17 08:37:50 [debug] 2034#0: timer delta: 4205
2014/09/17 08:37:50 [debug] 2034#0: posted events 0000000001661460
2014/09/17 08:37:50 [debug] 2034#0: posted event 0000000001661460
2014/09/17 08:37:50 [debug] 2034#0: posted event 0000000000000000
2014/09/17 08:37:50 [debug] 2034#0: worker cycle
2014/09/17 08:37:50 [debug] 2034#0: epoll timer: 7400
2014/09/17 09:03:15 [debug] 2144#0: bind() 0.0.0.0:80 #46
2014/09/17 09:03:15 [debug] 2144#0: counter: 00007F697920F080, 1
2014/09/17 09:03:15 [debug] 2144#0: posix_memalign: 00000000011CF400:16384 @16
2014/09/17 09:03:18 [debug] 2153#0: bind() 0.0.0.0:80 #46
2014/09/17 09:03:18 [emerg] 2153#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/09/17 09:03:18 [notice] 2153#0: try again to bind() after 500ms
2014/09/17 09:03:18 [debug] 2153#0: bind() 0.0.0.0:80 #46
2014/09/17 09:03:18 [emerg] 2153#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/09/17 09:03:18 [notice] 2153#0: try again to bind() after 500ms
2014/09/17 09:03:18 [debug] 2153#0: bind() 0.0.0.0:80 #46
2014/09/17 09:03:18 [emerg] 2153#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/09/17 09:03:18 [notice] 2153#0: try again to bind() after 500ms
2014/09/17 09:03:18 [debug] 2153#0: bind() 0.0.0.0:80 #46
2014/09/17 09:03:18 [emerg] 2153#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/09/17 09:03:18 [notice] 2153#0: try again to bind() after 500ms
2014/09/17 09:03:18 [debug] 2153#0: bind() 0.0.0.0:80 #46
2014/09/17 09:03:18 [emerg] 2153#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/09/17 09:03:18 [notice] 2153#0: try again to bind() after 500ms
2014/09/17 09:03:18 [emerg] 2153#0: still could not bind()
答案 0 :(得分:0)
(对于未来发现此事的人)
还有其他东西在端口80上侦听。可能是另一个http服务器(可能)或者你打算在80上听的东西(不太可能)
使用netstat -plnt | grep ':80'
查找它是什么。