mirror of
https://github.com/sheptikhinv/timers.git
synced 2026-02-07 07:41:36 +05:00
Add Docker setup for Nginx serving built Node app
Introduce a multi-stage Dockerfile to build and serve a Node.js application using Nginx. Define a custom Nginx configuration for optimized static file handling and enable gzip compression.
This commit is contained in:
parent
15db906f33
commit
f94c90456f
2 changed files with 62 additions and 0 deletions
51
.docker/app/nginx/nginx.conf
Normal file
51
.docker/app/nginx/nginx.conf
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
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;
|
||||
|
||||
gzip on;
|
||||
gzip_comp_level 6;
|
||||
gzip_http_version 1.1;
|
||||
gzip_proxied any;
|
||||
gzip_min_length 256;
|
||||
gzip_types text/plain text/css application/javascript application/x-javascript application/xml application/xml+rss application/atom+xml image/svg+xml;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue