Rearrange log tracking sections
This commit is contained in:
parent
fd00d16c37
commit
f18ceeb663
3 changed files with 126 additions and 105 deletions
|
|
@ -45,8 +45,11 @@ COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
COPY --from=builder /app/public/images/ /usr/share/nginx/html/images/
|
COPY --from=builder /app/public/images/ /usr/share/nginx/html/images/
|
||||||
COPY --from=builder /app/public/subtitles /usr/share/nginx/html/subtitles
|
COPY --from=builder /app/public/subtitles /usr/share/nginx/html/subtitles
|
||||||
COPY --from=builder /app/public/transcriptions /usr/share/nginx/html/transcriptions
|
COPY --from=builder /app/public/transcriptions /usr/share/nginx/html/transcriptions
|
||||||
|
# Copy configurations
|
||||||
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
COPY matomo_log_format.conf /etc/nginx/conf.d/
|
COPY matomo_log_format.conf /etc/nginx/conf.d/
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY default.conf /etc/nginx/conf.d/
|
||||||
|
|
||||||
|
|
||||||
# Add runner stage verification to the file
|
# Add runner stage verification to the file
|
||||||
RUN echo "\n=== RUNNER STAGE: Verifying nginx html directory structure ===" >> /verification.txt && \
|
RUN echo "\n=== RUNNER STAGE: Verifying nginx html directory structure ===" >> /verification.txt && \
|
||||||
|
|
|
||||||
106
default.conf
Normal file
106
default.conf
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
server {
|
||||||
|
listen 804;
|
||||||
|
server_name localhost;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# Updated log paths and format
|
||||||
|
access_log /var/log/nginx/deafgain-website/access.log matomo_tracking buffer=512k flush=1m;
|
||||||
|
error_log /var/log/nginx/deafgain-website/error.log error;
|
||||||
|
|
||||||
|
# Increased buffer sizes
|
||||||
|
large_client_header_buffers 8 32k;
|
||||||
|
client_header_buffer_size 32k;
|
||||||
|
client_max_body_size 10M;
|
||||||
|
client_body_buffer_size 128k;
|
||||||
|
|
||||||
|
# Security headers
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Content-Type-Options "nosniff";
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000";
|
||||||
|
|
||||||
|
# Compression
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
|
||||||
|
# API endpoint
|
||||||
|
location /api/contact {
|
||||||
|
proxy_pass http://api:3000;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/deafgain-website/access.log matomo_tracking buffer=512k flush=1m;
|
||||||
|
error_log /var/log/nginx/deafgain-website/error.log error;
|
||||||
|
|
||||||
|
# CORS headers
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||||
|
|
||||||
|
# Handle OPTIONS method
|
||||||
|
if ($request_method = 'OPTIONS') {
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||||
|
add_header 'Access-Control-Max-Age' 1728000;
|
||||||
|
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||||
|
add_header 'Content-Length' 0;
|
||||||
|
return 204;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
expires 1h;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Video files handling
|
||||||
|
location /videos/ {
|
||||||
|
alias /usr/share/nginx/html/videos/;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
types {
|
||||||
|
video/mp4 mp4;
|
||||||
|
}
|
||||||
|
add_header Accept-Ranges bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Images handling
|
||||||
|
location /images/ {
|
||||||
|
alias /usr/share/nginx/html/images/;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
types {
|
||||||
|
image/png png;
|
||||||
|
image/jpeg jpg jpeg;
|
||||||
|
image/svg+xml svg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Subtitles handling
|
||||||
|
location /subtitles/ {
|
||||||
|
alias /usr/share/nginx/html/subtitles/;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
types {
|
||||||
|
text/vtt vtt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Transcriptions handling
|
||||||
|
location /transcriptions/ {
|
||||||
|
alias /usr/share/nginx/html/transcriptions/;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
types {
|
||||||
|
text/plain txt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Static asset caching
|
||||||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|vtt|txt)$ {
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
}
|
||||||
|
}
|
||||||
120
nginx.conf
120
nginx.conf
|
|
@ -1,106 +1,18 @@
|
||||||
server {
|
user nginx;
|
||||||
listen 804;
|
worker_processes auto;
|
||||||
server_name localhost;
|
pid /var/run/nginx.pid;
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html;
|
|
||||||
|
|
||||||
# Updated log paths and format
|
events {
|
||||||
access_log /var/log/nginx/deafgain-website/access.log matomo_tracking buffer=512k flush=1m;
|
worker_connections 1024;
|
||||||
error_log /var/log/nginx/deafgain-website/error.log error;
|
}
|
||||||
|
|
||||||
# Increased buffer sizes
|
http {
|
||||||
large_client_header_buffers 8 32k;
|
include /etc/nginx/mime.types;
|
||||||
client_header_buffer_size 32k;
|
default_type application/octet-stream;
|
||||||
client_max_body_size 10M;
|
|
||||||
client_body_buffer_size 128k;
|
# Include Matomo log format
|
||||||
|
include /etc/nginx/conf.d/matomo_log_format.conf;
|
||||||
# Security headers
|
|
||||||
add_header X-Frame-Options "SAMEORIGIN";
|
# Include server configurations
|
||||||
add_header X-XSS-Protection "1; mode=block";
|
include /etc/nginx/conf.d/*.conf;
|
||||||
add_header X-Content-Type-Options "nosniff";
|
|
||||||
add_header Strict-Transport-Security "max-age=31536000";
|
|
||||||
|
|
||||||
# Compression
|
|
||||||
gzip on;
|
|
||||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
||||||
|
|
||||||
# API endpoint
|
|
||||||
location /api/contact {
|
|
||||||
proxy_pass http://api:3000;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
access_log /var/log/nginx/deafgain-website/access.log matomo_tracking buffer=512k flush=1m;
|
|
||||||
error_log /var/log/nginx/deafgain-website/error.log error;
|
|
||||||
|
|
||||||
# CORS headers
|
|
||||||
add_header 'Access-Control-Allow-Origin' '*';
|
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
|
||||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
|
||||||
|
|
||||||
# Handle OPTIONS method
|
|
||||||
if ($request_method = 'OPTIONS') {
|
|
||||||
add_header 'Access-Control-Allow-Origin' '*';
|
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
|
||||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
|
||||||
add_header 'Access-Control-Max-Age' 1728000;
|
|
||||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
|
||||||
add_header 'Content-Length' 0;
|
|
||||||
return 204;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
expires 1h;
|
|
||||||
add_header Cache-Control "public, no-transform";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Video files handling
|
|
||||||
location /videos/ {
|
|
||||||
alias /usr/share/nginx/html/videos/;
|
|
||||||
add_header Cache-Control "public, no-transform";
|
|
||||||
types {
|
|
||||||
video/mp4 mp4;
|
|
||||||
}
|
|
||||||
add_header Accept-Ranges bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Images handling
|
|
||||||
location /images/ {
|
|
||||||
alias /usr/share/nginx/html/images/;
|
|
||||||
add_header Cache-Control "public, no-transform";
|
|
||||||
types {
|
|
||||||
image/png png;
|
|
||||||
image/jpeg jpg jpeg;
|
|
||||||
image/svg+xml svg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Subtitles handling
|
|
||||||
location /subtitles/ {
|
|
||||||
alias /usr/share/nginx/html/subtitles/;
|
|
||||||
add_header Cache-Control "public, no-transform";
|
|
||||||
types {
|
|
||||||
text/vtt vtt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Transcriptions handling
|
|
||||||
location /transcriptions/ {
|
|
||||||
alias /usr/share/nginx/html/transcriptions/;
|
|
||||||
add_header Cache-Control "public, no-transform";
|
|
||||||
types {
|
|
||||||
text/plain txt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Static asset caching
|
|
||||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|vtt|txt)$ {
|
|
||||||
expires 30d;
|
|
||||||
add_header Cache-Control "public, no-transform";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue