Lawson 2015-10-30 02:18 采纳率: 0%
浏览 2199

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;
#    }
#}

}

  • 写回答

1条回答 默认 最新

  • oyljerry 2015-10-30 07:34
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏