2026-06-24 20:31:05 +05:00

122 lines
3.4 KiB
Nginx Configuration File

worker_processes auto;
error_log /proc/self/fd/1 crit;
pid /tmp/nginx.pid;
daemon off;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
map $msec $msec_no_decimal { ~(.*)\.(.*) $1$2; }
map "$http_x_forwarded_for:$remote_addr" $fallback_forwarded_for {
default "$http_x_forwarded_for, $realip_remote_addr";
"~^:" $realip_remote_addr;
}
log_format custom escape=json
'{'
'"time":$msec_no_decimal,'
'"pid":"$pid",'
'"name":"datalens-ui",'
'"hostname":"$hostname",'
'"req":{'
'"id":"$request_id",'
'"method":"$request_method",'
'"url":"$request_uri",'
'"referer":"$http_referer",'
'"user_agent":"$http_user_agent",'
'"headers":{'
'"host":"$host",'
'"x-forwarded-for":"$fallback_forwarded_for"'
'}'
'},'
'"res":{'
'"statusCode": $status'
'},'
'"responseTime":"$request_time"'
'"level":"ACCESS",'
'"msg":"[$status] [$request_time] $http_host $remote_addr `$request` [$request_id]"'
'}';
access_log /proc/self/fd/1 custom;
error_log /proc/self/fd/1 crit;
keepalive_timeout 100;
proxy_connect_timeout 365s;
proxy_send_timeout 365s;
proxy_read_timeout 365s;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_cache shared:SSL:128m;
ssl_session_timeout 28h;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
proxy_buffer_size 32k;
proxy_buffers 8 32k;
fastcgi_buffers 8 32k;
fastcgi_buffer_size 32k;
client_header_buffer_size 5120k;
large_client_header_buffers 16 5120k;
client_max_body_size 200m;
client_body_buffer_size 128k;
include /etc/nginx/mime.types;
default_type application/octet-stream;
gzip on;
gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json;
server {
listen 8080;
add_header Access-Control-Allow-Headers "Content-Type,X-Request-ID,X-Charts-Cache-Token,X-Charts-Request-ID,X-CSRF-Token,X-DL-Allow-Superuser,X-DL-Sudo,X-Chart-Id,X-Timezone-Offset,X-Dash-Info,x-dl-tenantid";
add_header Access-Control-Expose-Headers "X-Request-Id, X-Trace-Id" always;
add_header Access-Control-Allow-Credentials "true" always;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
add_header Access-Control-Max-Age 86400;
if ($request_method = OPTIONS) {
return 200;
}
proxy_hide_header Access-Control-Allow-Origin;
root /opt/app/dist/public;
location / {
try_files $uri @node;
}
location @node {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:3030;
proxy_redirect off;
}
}
fastcgi_intercept_errors on;
}