Skip to content

Commit

Permalink
Add custom nginx conf for kb manager
Browse files Browse the repository at this point in the history
  • Loading branch information
ninori9 committed Jan 4, 2025
1 parent 87708d0 commit 3435346
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN npm run build -- --configuration=production --base-href=/knowledge-manager/

# Stage 2: Serve the app with NGINX
FROM nginx:stable-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist/knowledge-manager /usr/share/nginx/html

# Expose port 80 for internal communication
Expand Down
23 changes: 23 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
server {
listen 80;
server_name localhost;

# Serve Angular app from /usr/share/nginx/html/browser
root /usr/share/nginx/html/browser;
index index.html;

# Handle Angular routing
location /knowledge-manager/ {
try_files $uri /index.html;
}

# Redirect 404 errors to Angular's index.html
error_page 404 /index.html;

# Optional: Add cache control for static files
location ~* \.(?:ico|css|js|woff2?|eot|ttf|otf|svg|png|jpg|jpeg|gif|webp|avif|mp4|webm|ogg|mp3|wav|flac|aac)$ {
expires 6M;
access_log off;
add_header Cache-Control "public";
}
}

0 comments on commit 3435346

Please sign in to comment.