Skip to content

Commit

Permalink
nextcloud: Improve logging and enable brotli
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo1003 committed Oct 7, 2024
1 parent 37260e2 commit 4d552a8
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion nextcloud/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ daemon off;
user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log warn;
error_log stderr warn;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx/nginx.pid;

events {
Expand Down Expand Up @@ -33,6 +34,19 @@ http {
default "immutable";
}

map $status $probe_status_logging {
~^[23]\d{2} 0; # 2XX or 3XX indicates success Kubernetes HTTP probe
default 1; # Log failure probe requests
}
# Map to determine if the request should be logged
map $http_user_agent $probe_logging {
~^kube-probe $probe_status_logging; # User-Agent matched, do further status check
default 1;
}

access_log /var/log/nginx/access.log if=$probe_logging
access_log /dev/stdout if=$probe_logging

server {
listen 80 default_server;
listen [::]:80 default_server;
Expand Down Expand Up @@ -64,6 +78,12 @@ http {
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# Enable brotli
brotli on;
brotli_static on;
brotli_comp_level 4;
brotli_min_length 256;
brotli_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

# Pagespeed is not supported by Nextcloud, so if your server is built
# with the `ngx_pagespeed` module, uncomment this line to disable it.
Expand Down

0 comments on commit 4d552a8

Please sign in to comment.