rename nginx.conf -> default.conf, update Dockerfile (use nginx config templates instead of overriding the nginx.conf)
This commit is contained in:
parent
94e6397f68
commit
d9327f48f4
|
@ -26,7 +26,7 @@ RUN yarn build
|
||||||
#Stage 2
|
#Stage 2
|
||||||
|
|
||||||
FROM nginx:1.20-alpine
|
FROM nginx:1.20-alpine
|
||||||
COPY --from=build-deps /usr/src/app/public /var/www
|
COPY --from=build-deps /usr/src/app/build /var/www
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
COPY default.conf /etc/nginx/templates/default.conf.template
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|
30
default.conf
Normal file
30
default.conf
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
server {
|
||||||
|
# listen on port 80
|
||||||
|
listen 80;
|
||||||
|
# save logs here
|
||||||
|
access_log /var/log/nginx/access.log combined;
|
||||||
|
|
||||||
|
# where the root here
|
||||||
|
root /var/www;
|
||||||
|
# what file to server as index
|
||||||
|
index index.html index.htm;
|
||||||
|
error_page 404 /404/index.html;
|
||||||
|
|
||||||
|
# Fonts and media: images, icons, video, audio, HTC
|
||||||
|
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|ttf)$ {
|
||||||
|
expires 1M;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Javascript and CSS files
|
||||||
|
location ~* \.(?:css|webmanifest|js|woff2|manifest)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# First attempt to serve request as file, then
|
||||||
|
# as directory, then fall back to redirecting to index.html
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
}
|
49
nginx.conf
49
nginx.conf
|
@ -1,49 +0,0 @@
|
||||||
# auto detects a good number of processes to run
|
|
||||||
worker_processes auto;
|
|
||||||
|
|
||||||
#Provides the configuration file context in which the directives that affect connection processing are specified.
|
|
||||||
events {
|
|
||||||
# Sets the maximum number of simultaneous connections that can be opened by a worker process.
|
|
||||||
worker_connections 8000;
|
|
||||||
# Tells the worker to accept multiple connections at a time
|
|
||||||
multi_accept on;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
http {
|
|
||||||
# what times to include
|
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
# what is the default one
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
server {
|
|
||||||
# listen on port 80
|
|
||||||
listen 80;
|
|
||||||
# save logs here
|
|
||||||
access_log /var/log/nginx/access.log combined;
|
|
||||||
|
|
||||||
# where the root here
|
|
||||||
root /var/www;
|
|
||||||
# what file to server as index
|
|
||||||
index index.html index.htm;
|
|
||||||
error_page 404 /404/index.html;
|
|
||||||
|
|
||||||
# Fonts and media: images, icons, video, audio, HTC
|
|
||||||
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|ttf)$ {
|
|
||||||
expires 1M;
|
|
||||||
add_header Cache-Control "public";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Javascript and CSS files
|
|
||||||
location ~* \.(?:css|webmanifest|js|woff2|manifest)$ {
|
|
||||||
expires 1y;
|
|
||||||
add_header Cache-Control "public";
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
# First attempt to serve request as file, then
|
|
||||||
# as directory, then fall back to redirecting to index.html
|
|
||||||
try_files $uri $uri/ =404;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user