nginx-Nginx报错 malloc failed

问题描述

Nginx报错 malloc failed

Nginx 版本:1.9.6.1 一开始那几天还好,最近几天经常报内存不足的错误,而且是不稳定重现,

贴上配置,服务器配置:16核32G windows 2008

#user nobody;
worker_processes 8;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 32768;
}

http {
include mime.types;
default_type application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;
#large_client_header_buffers 8 128k;

    # 设定请求缓冲 设置开始 

    #server_names_hash_bucket_size 128;

    client_header_buffer_size 128k;

    large_client_header_buffers 4 256k;

    client_max_body_size 64M; # 允许客户端请求的最大单文件字节数

    client_body_buffer_size 128k;  # 缓冲区代理缓冲用户端请求的最大字节数

    # 设定请求缓冲 设置结束

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

    #                  '$status $body_bytes_sent "$http_referer" '

    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;

    tcp_nopush     on;

    #keepalive_timeout  0;

    keepalive_timeout  150;

    tcp_nodelay on;

    fastcgi_connect_timeout 300;

    fastcgi_send_timeout 300;

    fastcgi_read_timeout 300;

    fastcgi_buffer_size 64k;

    fastcgi_buffers 4 64k;

    fastcgi_busy_buffers_size 128k;

    fastcgi_temp_file_write_size 128k;

    ##cache 配置 ##

    proxy_connect_timeout 600;#nginx 跟后端服务器连接超时时间 ( 代理连接超时 )

    proxy_read_timeout 600;# 连接成功后,后端服务器响应时间 ( 代理接收超时 )

    proxy_send_timeout 600; # 后端服务器数据回传时间 ( 代理发送超时 )

    proxy_buffer_size 64M;  # 设置代理服务器( nginx )保存用户头信息的缓冲区大小

    proxy_buffers 4 64M;  #proxy_buffers 缓冲区,网页平均在 32k 以下的话,这样设置

    proxy_busy_buffers_size 128M;# 高负荷下缓冲大小( proxy_buffers*2 )

    proxy_temp_file_write_size 200m;# 设定缓存文件夹大小,大于这个值,将从 upstream 服务器传

    #gzip 压缩开始

    gzip  on;

    gzip_min_length   1k;

    gzip_buffers   4 8k;

    gzip_http_version  1.1;

    gzip_types   text/plain image/jpg image/jpeg image/gif image/png;

    gzip_disable "MSIE [1-6].";

    #gzip 压缩结束

    #服务器的集群
    upstream  www.fryp.cn{
        #ip_hash;
        #服务器集群名字
        #server   172.16.21.13:8081 weight=1;#服务器配置   weight是权重的意思,权重越大,分配的概率越大。
        server    10.251.148.218 max_fails=3 fail_timeout=30s weight=10;
        server    10.144.229.83 max_fails=3 fail_timeout=30s weight=10;
        server    10.163.200.195 max_fails=3 fail_timeout=30s weight=15;
        server    10.163.226.8 max_fails=3 fail_timeout=30s weight=20;

        #server    10.165.59.203:8001 max_fails=3 fail_timeout=30s weight=10;
        #server    10.165.59.203:8002 max_fails=3 fail_timeout=30s weight=10;
        #server    10.165.59.203:8003 max_fails=3 fail_timeout=30s weight=10;
} 

server {
    listen       80;
    server_name  www.fryp.cn;
    #charset koi8-r;

    access_log  logs/host.access.log ;

    if ($http_user_agent ~* "Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|MSNBot|ia_archiver|Tomato Bot") {
            return 403;
    }  

    location / {
        proxy_pass http://www.fryp.cn;
        proxy_redirect default;  

        # 传递真实 ip 给分发服务器 获取真实访问用户 ip
        # 在后台可以使用 HttpContext.Current.Request.Headers["X-Real-IP"]

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    # 请求包含 Admin 带头的所有文件

    location /Content {

    proxy_pass http://www.fryp.cn;

    proxy_redirect  off;

    proxy_set_header Host $host;

    # 请求静态文件设置

    proxy_cache_valid 200 302 1d;# 设置 http 状态码为 200,302 缓存时间为 1 小时

    proxy_cache_valid 301 1d;# 设置失期时间,为 30 天

    proxy_cache_valid any 1h;

    expires 30d;

    # 传递真实 ip 给分发服务器

    proxy_set_header X-Real-IP $remote_addr;

    }

    # 请求包含 Resource 带头的所有文件

    location /Resource {

    proxy_pass http://www.fryp.cn;

    proxy_redirect  off;

    proxy_set_header Host $host;

    # 请求静态文件设置

    proxy_cache_valid 200 302 1d;# 设置 http 状态码为 200,302 缓存时间为 1 小时

    proxy_cache_valid 301 1d;# 设置失期时间,为 30 天

    proxy_cache_valid any 1m;

    expires 30d;

    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    #location = /50x.html {
    #    root   html;
    #}

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ .php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ .php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /.ht {
    #    deny  all;
    #}
}

# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#    listen       8000;
#    listen       somename:8080;
#    server_name  somename  alias  another.alias;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}

# HTTPS server
#
#server {
#    listen       443;
#    server_name  localhost;

#    ssl                  on;
#    ssl_certificate      cert.pem;
#    ssl_certificate_key  cert.key;

#    ssl_session_timeout  5m;

#    ssl_protocols  SSLv2 SSLv3 TLSv1;
#    ssl_ciphers  HIGH:!aNULL:!MD5;
#    ssl_prefer_server_ciphers   on;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}

}

解决方案

你这是内存不够了,系统资源被吃太多了。

时间: 2024-11-03 21:56:58

nginx-Nginx报错 malloc failed的相关文章

nginx+fastdfs报错conf file must have item

问题描述 nginx+fastdfs报错conf file must have item fastdfs安装配置没问题,使用fastdfs_test测试也能上传,但是安装完nginx及其module后启动nginx时 nginx错误显示:[2015-12-12 18:13:19] ERROR - file: ../storage/trunk_mgr/trunk_shared.c, line: 106, conf file must have item "store_path1"! 而浏

nginx日志报错:ngnix:[notice] 30499#0: signal process started

问题描述 nginx日志报错:ngnix:[notice] 30499#0: signal process started 前台页面显示:500 Internal Server Error,在nginx日志报的错:ngnix:[notice] 30499#0: signal process started,这是什么问题的错误呢. 解决方案 查看access.log中,nginx怎么处理的

Eclipse搭建C++开发环境报错Launch failed.Binary not found

问题描述: Eclipse搭建C++开发环境后,运行HelloWorld程序,报错launch failed.binary not found 解决办法: 1 C++工程右键 ---> Build Configurations ---> Build Selected---> 同时勾选Debug和Release 2 C++工程右键 ---> Run As ---> Local C/C++ Application

android开发-android.net.nsd 发现服务时随机重启报错 dequeueBuffer failed

问题描述 android.net.nsd 发现服务时随机重启报错 dequeueBuffer failed 小弟最近在做安卓的开发,用了android.net.nsd的服务注册与发现.在模拟器上调试的时候没有发现任何问题.但是将demo放到智能电视的时候出了问题.程序有时正常有时会重启.进过不断的调试发现是在启动NSD服务发现的时候报错了. 报错信息如下: 09-30 15:10:56.760: I/sg_life(11572): start discover-- 09-30 15:10:56.

sdk-android报错:Failed to allocate memory: 8

问题描述 android报错:Failed to allocate memory: 8 从今天开始,当我想要再NetBeans运行一个应用程序的时候,就显示下边的错误: Failed to allocate memory: 8 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more inf

PHP上传报错:failed to open stream: Permission denied

问题描述 PHP上传报错:failed to open stream: Permission denied 代码一: doAction.php代码: 选择图片,上传报错: 解决方案 PHP failed to open stream: Permission denied关于php使用fopen报错 failed to open stream: Permission deniedfailed to open stream: Permission denied in 解决方案二: 权限不足,上传文件

oracle11g-Toad for Oracle 11(win7).exe报错CreateProcess failed

问题描述 Toad for Oracle 11(win7).exe报错CreateProcess failed 我在启动toad for oracle 11(win7) 的时候,一直报RelaunchUsingCreateProcess::CreateProcess failed "C:Program Files(x86)Quest SoftwareToad for Oracle 11Toad.exe"这个错误,我的环境是win7 64bit,使用的软件是一个绿色软件Toad for

mvn打包报错:Failed to load ApplicationContext

问题描述 mvn打包报错:Failed to load ApplicationContext ApplicationContext中扫描的包: /context:component-scan springmvc.xml中扫描的包: <context:component-scan base-package="com.aa.controller" /> 解决方案 问题已解决,pom配置文件中没有配置加载resources,所以加载不到resources目录下面的配置文件!加上配

nginx安装报错:nginx: [error] invalid PID number

搞了一个美国服务器,重新弄了下nginx安装配置,重新/usr/local/nginx/sbin/nginx -s reload 提示如下报错: [root@Kvmla-201606291067 conf]# /usr/local/nginx/sbin/nginx   -s reload nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid" 无效的pid号. 网上搜索资料解