在尝试实现upload progress module时,以下服务器配置导致打开文件过多错误
2014/11/19 12:10:34 [alert] 31761#0: *1010 socket() Failed (24: Too many open files) while connecting to upstream, client: 127.0.0.1, server: xxx, request: "GET /documents/15/edit HTTP/1.0", upstream: "http://127.0.0.1:80/documents/15/edit", host: "127.0.0.1"
2014/11/19 12:10:34 [crit] 31761#0: *1010 open() "/usr/share/Nginx/html/50x.html" Failed (24: Too many open files), client: 127.0.0.1, server: xxx, request: "GET /documents/15/edit HTTP/1.0", upstream: "http://127.0.0.1:80/documents/15/edit", host: "127.0.0.1"
以下是生成冲突的服务器块的相关部分
乘客启用;
rails_env开发;
root / home / user / app / current / public;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location / {
# proxy to upstream server
proxy_pass http://127.0.0.1;
proxy_redirect default;
# track uploads in the 'proxied' zone
# remember connections for 30s after they finished
track_uploads proxied 30s;
}
location ^~ /progress {
# report uploads tracked in the 'proxied' zone
report_uploads proxied;
}
作为Nginx的相对n00b,我不理解这会产生太多文件错误.我假设错误页面仅用于500-504服务器错误…
解决方法:
首先检查并增加root shell中的打开文件限制(系统范围内,通常为1024):
# ulimit -n
# ulimit -n 16384
然后你可以增加Nginx的开放文件限制(主要上下文,Nginx.conf的顶部):
worker_rlimit_nofile 16384
然后重启Nginx)
如果这没有帮助,请查看更多详细解决方案
Nginx: 24: Too Many Open Files Error And Solution
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。