frontend: add nginx.conf to limit worker processes (#226)

set the number of nginx workers to 2 to avoid exceeding memory, which can happen with default worker_processes: auto due to the cpu limit setting.
This commit is contained in:
Ilya Kreymer 2022-05-10 15:11:35 -04:00 committed by GitHub
parent ff42785410
commit 0fab6db75e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# central place to configure the production replayweb.pgae loading prefix
# central place to configure the production replayweb.page loading prefix
ARG RWP_BASE_URL=https://cdn.jsdelivr.net/npm/replaywebpage@1.5.8/
FROM node:16 as build
@ -32,7 +32,8 @@ ENV RWP_BASE_URL=${RWP_BASE_URL}
COPY --from=build /app/dist /usr/share/nginx/html
COPY ./nginx.conf.template /etc/nginx/templates/
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY ./frontend.template /etc/nginx/templates/
RUN rm /etc/nginx/conf.d/*

31
frontend/nginx.conf Normal file
View File

@ -0,0 +1,31 @@
user nginx;
worker_processes 2;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}