posix_memalign(16, 16384) failed (12: Cannot allocate memory)

JohnCarne nginx-forum at forum.nginx.org
Fri Sep 23 10:42:18 UTC 2016


I add my config at server level

#Core Functionality

user  nobody;
worker_processes  auto;
worker_rlimit_nofile 50000;
thread_pool iopool threads=32 max_queue=65536;
pid   /var/run/nginx.pid;
error_log /var/log/nginx/error_log;
#error_log /home/abackup/debug.log debug;

#Load Dynamic Modules
#include /etc/nginx/conf.d/dynamic_modules_custom.conf;

events {
worker_connections 2048;
use epoll;
multi_accept on;
accept_mutex off;
}

#Settings For other core modules like for example the stream module
include /etc/nginx/conf.d/main_custom_include.conf;

#Settings for the http core module
include /etc/nginx/conf.d/http_settings.conf;

***************************

http {

sendfile on;
sendfile_max_chunk 512k;
aio threads=iopool;
directio 50m;  #Serve Large files like media files using directio

tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 		60;
keepalive_disable msie6 safari;
types_hash_max_size     2048;

server_tokens off;
client_max_body_size    128m;
client_body_buffer_size 256k;
map_hash_bucket_size    128;
map_hash_max_size       2048;

#Tweak timeout settings below in case of a DOS attack
client_header_timeout  		1m;
client_body_timeout 		1m;
reset_timedout_connection	on;

connection_pool_size 		 512;
client_header_buffer_size    4k;
large_client_header_buffers  4 32k;
request_pool_size            8k;
output_buffers               4 32k;
postpone_output  			 1460;

#FastCGI
fastcgi_buffers				 16 16k;
fastcgi_buffer_size			 32k;
# the below options depend on theoretical maximum of your PHP script
run-time
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;

server_names_hash_max_size 256000;
server_names_hash_bucket_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;

ssl_protocols TLSv1.2 TLSv1.1 TLSv1;

# Open File Cache
open_file_cache          max=8192 inactive=5m;
open_file_cache_valid    5m;
open_file_cache_min_uses 2;
open_file_cache_errors   on;

# Logging Settings
open_log_file_cache max=1000 inactive=20s valid=1m min_uses=2;
#Mapping $msec to $sec so that we dont break cPanel bandwidth calculator
map $msec $sec {
        ~^(?P<secres>.+)\. $secres;
    }
log_format bytes_log "$sec $bytes_sent .";
log_not_found off;
access_log off;

# Micro-caching nginx
proxy_cache_path /var/cache/nginx/microcaching keys_zone=micro:20m
levels=1:2 inactive=900s max_size=2000m;
proxy_cache micro;
proxy_cache_lock on;
proxy_cache_valid 200 1s;
proxy_cache_use_stale updating;
proxy_cache_bypass $cookie_nocache $arg_nocache;

# GeoIP
# Uncomment to enable
#geoip_country         /usr/share/GeoIP/GeoLiteCountry.dat;
#geoip_city            /usr/share/GeoIP/GeoLiteCity.dat;

#Limit Request Zone conf
include /etc/nginx/conf.d/limit_request_custom.conf;
#
#CloudFare RealIP conf
include /etc/nginx/conf.d/cloudfare_realip.conf;
#
#FastCGI and PROXY cache config
include /etc/nginx/conf.d/nginx_cache.conf;
#
#Phusion Passenger Setting
include /etc/nginx/conf.d/passenger.conf;
#
#Custom Include File where you can include any custom settings
include /etc/nginx/conf.d/custom_include.conf;
#
# Virtual Host Configs
include /etc/nginx/conf.d/default_server.conf;
include /etc/nginx/sites-enabled/*.conf;
}

**********************************
vhost level
**********************************

location / {
	limit_req zone=FLOODPROTECT burst=100;
	limit_conn PERIP 125;
	limit_conn PERSERVER 500;
	
 	proxy_send_timeout 900;
   	proxy_read_timeout 900;

   	proxy_buffer_size    32k;
   	proxy_buffers     16 32k;
   	proxy_busy_buffers_size  64k;
   	proxy_temp_file_write_size  64k;
	
   	proxy_connect_timeout 300s;

   	proxy_pass   http://PROXYLOCATION;
   	proxy_set_header   Host   $host;
   	proxy_set_header   X-Real-IP  $remote_addr;
   	proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_redirect     off;
	proxy_set_header   Proxy "";
	}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,269787,269788#msg-269788



More information about the nginx mailing list