93 lines
2.6 KiB
Nginx Configuration File
93 lines
2.6 KiB
Nginx Configuration File
# Copyright 2026 Google LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
user nginx;
|
|
worker_processes auto;
|
|
worker_rlimit_nofile 65535;
|
|
error_log /var/log/nginx/error.log warn;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 4096;
|
|
multi_accept on;
|
|
use epoll;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
# High-performance event I/O settings
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
types_hash_max_size 2048;
|
|
server_tokens off;
|
|
|
|
# Client payload size (allows large artifact, image, APK uploads)
|
|
client_max_body_size 100M;
|
|
client_body_buffer_size 128k;
|
|
|
|
# Enhanced JSON-structured access logging for easy parsing & cloud monitoring
|
|
log_format artemis_json escape=json '{'
|
|
'"time_local":"$time_local",'
|
|
'"remote_addr":"$remote_addr",'
|
|
'"request_method":"$request_method",'
|
|
'"request_uri":"$request_uri",'
|
|
'"status":$status,'
|
|
'"body_bytes_sent":$body_bytes_sent,'
|
|
'"request_time":$request_time,'
|
|
'"upstream_response_time":"$upstream_response_time",'
|
|
'"upstream_addr":"$upstream_addr",'
|
|
'"upstream_status":"$upstream_status",'
|
|
'"http_referrer":"$http_referer",'
|
|
'"http_user_agent":"$http_user_agent"'
|
|
'}';
|
|
|
|
access_log /var/log/nginx/access.log artemis_json;
|
|
|
|
# Global proxy defaults
|
|
proxy_http_version 1.1;
|
|
proxy_connect_timeout 10s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_read_timeout 3600s;
|
|
|
|
# Gzip compression for static assets and API payloads
|
|
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/x-javascript
|
|
application/xml
|
|
application/xml+rss
|
|
image/svg+xml;
|
|
|
|
# WebSocket Upgrade Header Mapping
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
|
|
# Load modular server configurations
|
|
include /etc/nginx/conf.d/*.conf;
|
|
}
|