From e376618cd3bb4483fc9ebcf386d507757e15986f Mon Sep 17 00:00:00 2001 From: Meettya Date: Mon, 3 Feb 2025 00:50:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20nginx.conf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx.conf | 108 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 39 deletions(-) diff --git a/nginx.conf b/nginx.conf index 313ce02..4cfb8cb 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,19 +1,32 @@ +# Defines user and group credentials used by worker processes. user nginx; + +# Defines the number of worker processes. Generally, it should match the number of CPU cores. worker_processes auto; + +# Binds worker processes to the sets of CPUs. worker_cpu_affinity auto; + # Change the default thread pool settings thread_pool default threads=2 max_queue=16384; +# Limit on the maximum number of open files (RLIMIT_NOFILE) for worker processes. +worker_rlimit_nofile 32768; + +# Logging configuration. error_log /var/log/nginx/error.log notice; + +# Defines a file that will store the process ID of the main process. pid /var/run/nginx.pid; events { + # Maximum number of simultaneous connections that can be opened by a worker process. worker_connections 16384; # Serve many clients each thread (Linux only) use epoll; - - # Accept as many connections as possible + + # Accept as many connections as possible. If it is disabled, a worker process will accept one new connection at a time. multi_accept on; } @@ -38,7 +51,7 @@ http { log_not_found off; # Server will close connection after this time - keepalive_timeout 65; + keepalive_timeout 60; # Max size of types hash tables (processing static sets of data. eg. server names, map directives or mime types) types_hash_max_size 2048; @@ -56,54 +69,71 @@ http { # Allow the server to close connection on non responding client, this will free up memory reset_timedout_connection on; + # Include MIME (Multipurpose Internet Mail Extensions) types. include /etc/nginx/mime.types; + + # Defines the default MIME type of a response default_type application/octet-stream; + # Configures logging. log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; + # Sets the path, format, and configuration for a buffered log write. access_log /var/log/nginx/access.log main; - sendfile on; - keepalive_timeout 60; - gzip on; - gzip_disable msie6; + # Enabled compression using the “gzip” method. + gzip on; - gzip_vary on; + # Disables gzipping of responses for requests with “User-Agent” header fields matching any of the specified regular expressions. + gzip_disable msie6; + + # Enables inserting the “Vary: Accept-Encoding” response header field. + gzip_vary on; + + # Sets a gzip compression level of a response. Acceptable values are in the range from 1 to 9. gzip_comp_level 3; + + # Sets the minimum length of a response that will be gzipped. gzip_min_length 256; - gzip_buffers 16 8k; - gzip_proxied any; + + # Sets the number and size of buffers used to compress a response. + gzip_buffers 16 8k; + + # Enables compression for all proxied requests. + gzip_proxied any; + + # Enables gzipping of responses for the specified MIME types in addition to “text/html”. gzip_types - text/css - text/plain - text/javascript - text/cache-manifest - text/vcard - text/vnd.rim.location.xloc - text/vtt - text/x-component - text/x-cross-domain-policy - application/javascript - application/json - application/x-javascript - application/ld+json - application/xml - application/xml+rss - application/xhtml+xml - application/x-font-ttf - application/x-font-opentype - application/vnd.ms-fontobject - application/manifest+json - application/rss+xml - application/atom_xml - application/vnd.geo+json - application/x-web-app-manifest+json - image/svg+xml - image/x-icon - image/bmp - font/opentype; + text/css + text/plain + text/javascript + text/cache-manifest + text/vcard + text/vnd.rim.location.xloc + text/vtt + text/x-component + text/x-cross-domain-policy + application/javascript + application/json + application/x-javascript + application/ld+json + application/xml + application/xml+rss + application/xhtml+xml + application/x-font-ttf + application/x-font-opentype + application/vnd.ms-fontobject + application/manifest+json + application/rss+xml + application/atom_xml + application/vnd.geo+json + application/x-web-app-manifest+json + image/svg+xml + image/x-icon + image/bmp + font/opentype; include /etc/nginx/conf.d/*.conf; -} +} \ No newline at end of file