Fix nginx config for proxy to API server
This commit is contained in:
parent
8676a62f1e
commit
543318dd8a
@ -8,6 +8,7 @@ COPY . ./
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM nginx:alpine-slim
|
FROM nginx:alpine-slim
|
||||||
|
RUN rm -f /etc/nginx/nginx.conf
|
||||||
COPY ./nginx.conf /etc/nginx/nginx.conf
|
COPY ./nginx.conf /etc/nginx/nginx.conf
|
||||||
COPY --from=build /app/build /usr/share/nginx/html
|
COPY --from=build /app/build /usr/share/nginx/html
|
||||||
RUN chown -R nginx:nginx /usr/share/nginx/html
|
RUN chown -R nginx:nginx /usr/share/nginx/html
|
32
nginx.conf
32
nginx.conf
@ -26,24 +26,40 @@ http {
|
|||||||
|
|
||||||
#gzip-static on;
|
#gzip-static on;
|
||||||
|
|
||||||
|
proxy_cache_path /var/cache/nginx keys_zone=owl_cache:20m inactive=24h;
|
||||||
|
|
||||||
|
upstream backend {
|
||||||
|
server owlboard-backend:8460;
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
proxy_cache owl_cache;
|
||||||
|
|
||||||
root /usr/share/nginx/html;
|
add_header Content-Security-Policy "default-src 'self'";
|
||||||
index index.html;
|
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
gzip_static on;
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
try_files $uri $uri.html $uri/ =404;
|
try_files $uri $uri.html $uri/ =404;
|
||||||
|
add_header Cache-Control "public, no-transform, max-age=1209600";
|
||||||
}
|
}
|
||||||
|
|
||||||
#error_page 404 /404.html;
|
location /misc/ {
|
||||||
|
proxy_pass http://backend;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://backend;
|
||||||
|
proxy_cache_key $scheme://$host$uri$is_args$query_string;
|
||||||
|
proxy_ignore_headers Cache-Control;
|
||||||
|
proxy_cache_valid 200 2m; # Evaluate whether 2m or 1m is more appropriate
|
||||||
|
add_header Cache-Control "private, no-transform, max-age=120";
|
||||||
|
}
|
||||||
|
|
||||||
# redirect server error pages to the static page /50x.html
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,3 +1,3 @@
|
|||||||
export const version = '2023.7.1';
|
export const version = '2023.7.1';
|
||||||
export const versionTag = 'dev';
|
export const versionTag = 'beta';
|
||||||
export const showWelcome = true;
|
export const showWelcome = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user