feat: add support for routes in URL (custom nginx config)

This commit is contained in:
Arthur Schwaiger 2020-12-03 17:42:16 +01:00
parent 82cf57ad11
commit bdb50f38e5
2 changed files with 50 additions and 2 deletions

View File

@ -17,6 +17,7 @@ COPY . /app
RUN yarn build
FROM nginx:alpine
COPY --from=ui-builder /app/dist /usr/share/nginx/html
COPY --from=ui-builder /app/dist /etc/nginx/html
COPY --from=ui-builder /app/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx"]

47
nginx.conf Normal file
View File

@ -0,0 +1,47 @@
# run nginx in foreground
daemon off;
#user nobody;
worker_processes 1;
#error_log logs/error.log;
error_log stderr notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
# redirect 404 to index
try_files $uri /index.html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}