Nginx启动报错Cannot allocate memory

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

Nginx启动报错Cannot allocate memory

农凯戈   2020-03-06 我要评论
**本文转载自: https://www.93bok.com** ### 前言 今天改了nginx的一个配置参数,所以就reload了一下,我去,竟然报错了Cannot allocate memory起不来,日志报错如下: *** - 报错如下图 ![Pr3ihn.png](https://s1.ax1x.com/2018/08/06/Pr3ihn.png) ```bash [alert] 21470#0: mmap(MAP_ANON|MAP_SHARED, 536870912) failed (12: Cannot allocate memory) ``` ### 解决 ##### 1. 查看一下内存还剩多少 ```bash free -m ``` *** ```bash total used free shared buff/cache available Mem: 992 427 77 81 487 314 Swap: 0 0 0 ``` *** ##### 2. 修改配置文件 ```bash vim /etc/nginx/nginx.conf ``` *** ```bash fastcgi_cache_path https://img.qb5200.com/download-x/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. 修改完配置文件之后测试一下配置文件是否通过检测 ```bash 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成功

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们