zoukankan      html  css  js  c++  java
  • Nginx启动报错Cannot allocate memory

    本文转载自: https://www.93bok.com

    前言

    今天改了nginx的一个配置参数,所以就reload了一下,我去,竟然报错了Cannot allocate memory起不来,日志报错如下:


    • 报错如下图
      Pr3ihn.png
    [alert] 21470#0: mmap(MAP_ANON|MAP_SHARED, 536870912) failed (12: Cannot allocate memory)
    

    解决

    1. 查看一下内存还剩多少
    free -m
    

                  total        used        free      shared  buff/cache   available
    Mem:            992         427          77          81         487         314
    Swap:             0           0           0
    

    2. 修改配置文件
    vim /etc/nginx/nginx.conf
    

    fastcgi_cache_path /data/www/wordpress/fastcgi/ngx_fcgi_cache levels=2:2 keys_zone=ngx_fcgi_cache:500m inactive=30s max_size=5g;
    

    • 把上边的500m改成free内存的数量即可,但是也不要一点不剩,这里我改成了50m
    3. 修改完配置文件之后测试一下配置文件是否通过检测
    nginx -t
    
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    
    4. 重启nginx成功
  • 相关阅读:
    ps:图层知识
    ps:选区的存储及载入
    ps:消除锯齿和羽化
    ps:不规则选区
    ps:建立规则选区
    python如何查看内存占用空间
    python-生成器
    python3-列表生成式
    python:迭代
    Photoshop画笔工具的使用
  • 原文地址:https://www.cnblogs.com/93bok/p/12424895.html
Copyright © 2011-2022 走看看