Allow for low memory configurations < 2GB RAM so can be used on EC2 Free Tier
tecfu opened this issue · 5 comments
tecfu commented
Problem
nginx is requesting to allocate more than the maximum shared memory configured for the system.
This image uses a default shared memory allocation that is too high for my machine (an Amazon EC2 t2.micro instance).
Here is the error:
nginx: [alert] mmap(MAP_ANON|MAP_SHARED, 2147483648) failed (12: Out of memory)
From what I can tell this mean that the NGINX needs 2147483648 bytes or 2 GB of shared memory available.
tecfu commented
This won't work on an EC2 t2.micro (1GB RAM) or t2.small (2 GB RAM)
tecfu commented
I'm using the stock nginx.conf file that comes with the container.
worker_processes auto;
events {
use epoll;
}
http {
log_format main '$remote_addr $remote_user [$time_local] "$request" '
'$status "$http_referer" "$http_user_agent"';
access_log /dev/stdout main;
error_log stderr debug;
default_type application/octet-stream;
include /usr/local/nginx/conf/mime.types;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
vod_mode local;
vod_metadata_cache metadata_cache 16m;
vod_response_cache response_cache 2048m;
vod_last_modified_types *;
vod_segment_duration 9000;
vod_align_segments_to_key_frames on;
vod_dash_fragment_file_name_prefix "segment";
vod_hls_segment_file_name_prefix "segment";
vod_manifest_segment_durations_mode accurate;
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
aio on;
server {
listen 80;
server_name localhost;
root /opt/static;
location ~ ^/videos/.+$ {
autoindex on;
}
location /hls/ {
vod hls;
alias /opt/static/videos/;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
}
location /thumb/ {
vod thumb;
alias /opt/static/videos/;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
}
location /dash/ {
vod dash;
alias /opt/static/videos/;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
}
}
}
tecfu commented
I see, easy fix.
vod_response_cache response_cache 2048m;
Should be chaged to a number within your system's memory constraints.
Thanks guys, sorry to bother you.