Fix nginx logging configuration for statistics
- Create log directory in Dockerfile - Add proper logging configuration to default.conf - Mount logs directory in docker-compose.yml for persistence - Fixes 502 error caused by missing log directory
This commit is contained in:
parent
3e1892a6f7
commit
e3930cf87a
3 changed files with 8 additions and 2 deletions
|
|
@ -18,11 +18,12 @@ RUN pnpm build
|
||||||
# Production image
|
# Production image
|
||||||
FROM nginx:alpine AS runner
|
FROM nginx:alpine AS runner
|
||||||
|
|
||||||
# Create required directories
|
# Create required directories for web content and logs
|
||||||
RUN mkdir -p /usr/share/nginx/html/images/thumbnails \
|
RUN mkdir -p /usr/share/nginx/html/images/thumbnails \
|
||||||
/usr/share/nginx/html/subtitles \
|
/usr/share/nginx/html/subtitles \
|
||||||
/usr/share/nginx/html/transcriptions \
|
/usr/share/nginx/html/transcriptions \
|
||||||
/usr/share/nginx/html/videos
|
/usr/share/nginx/html/videos \
|
||||||
|
/var/log/nginx/deafgain-website
|
||||||
|
|
||||||
# Copy built app and static assets
|
# Copy built app and static assets
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@ server {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
# Logging configuration for statistics
|
||||||
|
access_log /var/log/nginx/deafgain-website/access.log combined;
|
||||||
|
error_log /var/log/nginx/deafgain-website/error.log error;
|
||||||
|
|
||||||
# Security headers
|
# Security headers
|
||||||
add_header X-Frame-Options "SAMEORIGIN";
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
add_header X-XSS-Protection "1; mode=block";
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- /docker/websites/deafgain/video_content:/usr/share/nginx/html/videos
|
- /docker/websites/deafgain/video_content:/usr/share/nginx/html/videos
|
||||||
|
- /docker/websites/deafgain/logs:/var/log/nginx/deafgain-website
|
||||||
networks:
|
networks:
|
||||||
- caddy_network
|
- caddy_network
|
||||||
- default
|
- default
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue