NGINX 多次崩溃

标签 nginx crash bind php epoll

我在使用 NGINX 时遇到问题。我有 3 个运行 NGINX 和 php-fpm 的负载平衡 (ELB) 系统 (EC2)。在所有 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'

以下是调试信息:
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()

最佳答案

(对于发现这个的 future 人)

端口 80 上正在监听其他东西。可能是另一个 http 服务器(可能)或您不打算在 80 上监听的东西(不太可能)

使用 netstat -plnt | grep ':80'找到它是什么。

关于NGINX 多次崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25895463/

相关文章:

http - Nginx 无法在端口 80 上工作

apache - 使用 Varnish 删除基于查询参数的 header

php - WordPress 父项和子项链接在 Nginx 上不起作用 SEO

php - 当我使用xampp启动moodle 2.6.2时,会发生appcrash问题

c# - 在程序集中找不到入口点'Microsoft.EntityFrameworkCore.Design,版本 = 1.1.0.0

jquery - 解除绑定(bind)后如何 "rebind"点击事件('click')?

python - Tkinter <Return> 功能不起作用

Kubernetes 上的 Nginx 代理

android - 如何获取 Mac 上 Android 模拟器崩溃的日志?

c++ - boost::绑定(bind)访问器?