Добрался до конфигурации, скину почти полную конфигурацию:
load_module "/usr/lib64/nginx/modules/ngx_http_geoip_module.so";
load_module "/usr/lib64/nginx/modules/ndk_http_module.so";
load_module "/usr/lib64/nginx/modules/ngx_http_lua_module.so";
load_module "/usr/lib64/nginx/modules/ngx_http_brotli_filter_module.so";
load_module "/usr/lib64/nginx/modules/ngx_http_brotli_static_module.so";
user nginx nginx;
worker_rlimit_nofile 245760;
worker_processes 24;
worker_priority -10;
worker_cpu_affinity auto 000000000000111111111111000000000000111111111111;
pid /var/run/nginx.pid;
pcre_jit on;
thread_pool local_pool threads=8; # Pool for local filesystem
thread_pool nfs_pool threads=8; # Pool for NFS-share
events {
worker_connections 10240;
use epoll;
multi_accept on;
accept_mutex off;
}
http {
include mime.types;
default_type application/octet-stream;
log_format json escape=json '{'
'"request_id":"$request_id",'
'"remote_addr":"$remote_addr",'
'"http_host":"$http_host",'
'"server_name":"$server_name",'
'"domain_tags":"$domain_tags",'
'"ssl_auth":"$ssl_client_verify",'
'"ssl_cn":"$ssl_client_s_dn",'
'"timestamp":"$time_local",'
'"status":"$status",'
'"request_time":"$request_time",'
'"upstream_name":"$upstream_name",' # custom variable
'"upstream_status":"$upstream_status",'
'"upstream_queue_time":"$upstream_response_time",'
'"upstream_connect_time":"$upstream_response_time",'
'"upstream_header_time":"$upstream_response_time",'
'"upstream_response_time":"$upstream_response_time",'
'"upstream_cache_status":"$upstream_cache_status",'
'"upstream_addr":"$upstream_addr",'
'"request_method":"$request_method",'
'"request_uri":"$request_uri",'
'"protocol":"$server_protocol",'
'"bytes_received":"$request_length",'
'"bytes_sent":"$body_bytes_sent",'
'"referer":"$http_referer",'
'"user_agent":"$http_user_agent",'
'"x_requested_with":"$http_x_requested_with",'
'"scheme":"$scheme"'
'}';
access_log syslog:server=unix:/dev/log,tag=access_log,facility=local6 json;
error_log syslog:server=unix:/dev/log,tag=error_log,facility=local7 warn;
# Disk read settings
sendfile on;
sendfile_max_chunk 256k;
aio threads=local_pool;
aio_write on;
directio 4m; # this is disabled in location where are used files from NFS-share
output_buffers 1 2m;
read_ahead 512k; # ignored in Linux
# Buffers
large_client_header_buffers 4 32k;
client_body_buffer_size 128k;
# TCP-socket settings
keepalive_timeout 15 15;
keepalive_requests 1000;
tcp_nopush on;
tcp_nodelay on;
reset_timedout_connection on;
# Internal memory structures
open_file_cache max=1000000 inactive=40s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
open_log_file_cache max=500 inactive=30m valid=10m min_uses=1;
variables_hash_max_size 2048;
variables_hash_bucket_size 128;
server_names_hash_max_size 1024;
server_names_hash_bucket_size 128;
map_hash_bucket_size 128;
# Response settings
server_tokens off;
# Internal behavior settings
uninitialized_variable_warn on;
# Proxy settings
proxy_http_version 1.1; # for keepalive to upstream
# Proxy errors and redirects behavior
proxy_redirect off; # Rewrite header location on redirect
proxy_intercept_errors on; # Intercept and handle errors by nginx
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
# Proxy timeouts
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
# Proxy buffers
proxy_buffering on;
proxy_buffer_size 64k;
proxy_buffers 128 128k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_ignore_headers Set-Cookie;
proxy_hide_header X-Powered-By;
proxy_ignore_client_abort on;
# Proxy temp path
proxy_temp_path /var/tmp/nginx/vhosts_proxy_temp;
client_body_temp_path /var/tmp/nginx/vhosts_client_body_temp;
# GZip and Brotli configuration was here
# GeoIP settings
geoip_country /usr/share/GeoIP/GeoIP.dat;
geoip_city /usr/share/GeoIP/GeoIPCity.dat;
# Request limit
client_max_body_size 10m;
# Req and conn zones
limit_req_log_level info; # Loglevel for request limit exceeded. Currently unused.
limit_conn_log_level info; # Loglevel for connection limit exceeded. Currently unused.
# Lua settings
lua_code_cache on; # Disable only for debug!
# UserID settings
userid on;
userid_expires max;
userid_name __utmd;
userid_path /;
userid_p3p 'CP="CUR ADM OUR NOR STA NID"';
# SSL configuration was here
resolver 127.0.0.1 ipv6=off;
resolver_timeout 5s;
# Map for client split, use $httpd_testing_upstream in proxy_pass for use this upstream
map $remote_addr $httpd_testing_upstream {
default httpd_testing;
}
# Upstream server-list
upstream httpd_comboplayer {
server backend-01-1:8081 max_fails=5;
server backend-01-2:8081 max_fails=5;
}
server {
# listen, server_name and SSL configuration was here
# Static files caching was here
# Root and last location
location / {
try_files $uri @proxy_upstream;
}
# Location for php files
location ~ \.php$ {
set $upstream_name $httpd_testing_upstream;
proxy_pass http://$httpd_testing_upstream;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $server_addr;
proxy_set_header X-Url-Scheme $scheme;
}
# Upstream location
location @proxy_upstream {
set $upstream_name $httpd_testing_upstream;
proxy_pass http://$httpd_testing_upstream;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $server_addr;
proxy_set_header X-Url-Scheme $scheme;
}
}
}