Files
nginx/data/nginx.conf
kbrianngeno 50b13c34ef Access log format, Proxy buffer size
Set access log format to json_combined
Increase proxy buffer sizes to fix frequent 502 errors on all sites
2026-03-17 18:12:39 +00:00

97 lines
2.7 KiB
Nginx Configuration File

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
keepalive_requests 100000;
variables_hash_max_size 2048;
server_names_hash_bucket_size 128;
server_tokens off;
resolver 8.8.8.8 valid=30s ipv6=off;
resolver_timeout 11s;
log_format json_combined escape=json '{'
'"method":"$request_method",'
'"scheme":"$scheme",'
'"domain":"$host",'
'"uri":"$request_uri",'
'"query_string":"$query_string",'
'"referer":"$http_referer",'
'"content_type":"$sent_http_content_type",'
'"status": $status,'
'"bytes_sent":$body_bytes_sent,'
'"request_time":$request_time,'
'"user_agent":"$http_user_agent",'
'"cache":"$upstream_cache_status",'
'"upstream_time": "$upstream_response_time",'
'"timestamp":"$time_iso8601",'
'"ip":"$http_x_forwarded_for"'
'}';
# log_format VCOMBINED '$host:$server_port '
# '$remote_addr $remote_user [$time_local] '
# '"$request" $status $body_bytes_sent '
# '"$http_referer" "$http_user_agent"';
access_log /var/log/nginx/access.log json_combined;
error_log /var/log/nginx/error.log debug;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
# Important for MinIO
client_max_body_size 0;
proxy_buffering off;
proxy_request_buffering off;
# Increase the buffer for the request line and headers
client_header_buffer_size 16k;
large_client_header_buffers 4 32k;
# If using Nginx as a proxy to the Harbor core/registry
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
# Add extra headers
add_header X-Frame-Options DENY;
add_header Content-Security-Policy "frame-ancestors 'none'";
# SSL Settings
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# Gzip Settings
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
# Include all server configurations
include /etc/nginx/conf.d/*.conf;
}