Linux

NGINX 和失敗(12:無法分配記憶體)

  • June 24, 2015

有人可以這麼好,並解釋我如何解決這個問題嗎?

在日誌 nginx 列印中:

2015/06/24 11:12:19 [alert] 2151#0: mmap(MAP_ANON|MAP_SHARED, 33554432) failed (12: Cannot allocate memory)

nginx.conf

user developer;
worker_processes auto;
pid /run/nginx.pid;

events {
   use epoll;
   worker_connections 30;
   multi_accept on;
}

http {

   ##
   # Basic Settings
   ##

   sendfile on;
   tcp_nopush on;
   tcp_nodelay on;
   #keepalive_timeout 65;
   keepalive_timeout 2;
   types_hash_max_size 2048;
   server_tokens off;

   # server_names_hash_bucket_size 64;
   # server_name_in_redirect off;

   include /etc/nginx/mime.types;
   default_type application/octet-stream;

   ##
   # Logging Settings
   ##

   access_log /var/log/nginx/access.log;
   error_log /var/log/nginx/error.log;

   ##
   # Gzip Settings
   ##

   gzip on;
   gzip_disable "msie6";
   gzip_min_length  1000;
   gzip_buffers     16 8k;

   gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;



   # MY CHANGES
   ssl_session_cache   shared:SSL:1m;
   ssl_session_timeout 5m;
   ssl_prefer_server_ciphers on;
   ssl_stapling on;
   resolver 8.8.8.8;
   geoip_country  /srv/www/geoipdb/GeoIP.dat;
   geoip_city     /srv/www/geoipdb/GeoLiteCity.dat;

   # Support the X-Forwarded-Proto header for fastcgi.
   map $http_x_forwarded_proto $fastcgi_https {
           default $https;
           http '';
           https on;
   }

   variables_hash_max_size 1024; # default 512
   upload_progress uploads 1m;

   include /etc/nginx/conf.d/*.conf;
   include apps/drupal/map_cache.conf;
   include /etc/nginx/sites-enabled/*;

}

貓 /etc/sysctl.conf

kernel.shmmax = 68719476736
kernel.shmall = 4294967296

我有 4G RAM 的 vps。在 plesk 記憶體選項卡中,我看到:

http://itmages.ru/image/view/2669317/4ab8f2d4

提前謝謝!

刪除數據包 nginx-extras 解決了問題

引用自:https://serverfault.com/questions/701229