Обновить nginx.conf

This commit is contained in:
Meettya 2025-02-03 00:50:16 +03:00
parent 7297705db8
commit e376618cd3

View File

@ -1,19 +1,32 @@
# Defines user and group credentials used by worker processes.
user nginx; user nginx;
# Defines the number of worker processes. Generally, it should match the number of CPU cores.
worker_processes auto; worker_processes auto;
# Binds worker processes to the sets of CPUs.
worker_cpu_affinity auto; worker_cpu_affinity auto;
# Change the default thread pool settings # Change the default thread pool settings
thread_pool default threads=2 max_queue=16384; 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; 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; pid /var/run/nginx.pid;
events { events {
# Maximum number of simultaneous connections that can be opened by a worker process.
worker_connections 16384; worker_connections 16384;
# Serve many clients each thread (Linux only) # Serve many clients each thread (Linux only)
use epoll; 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; multi_accept on;
} }
@ -38,7 +51,7 @@ http {
log_not_found off; log_not_found off;
# Server will close connection after this time # 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) # Max size of types hash tables (processing static sets of data. eg. server names, map directives or mime types)
types_hash_max_size 2048; 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 # Allow the server to close connection on non responding client, this will free up memory
reset_timedout_connection on; reset_timedout_connection on;
# Include MIME (Multipurpose Internet Mail Extensions) types.
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
# Defines the default MIME type of a response
default_type application/octet-stream; default_type application/octet-stream;
# Configures logging.
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; '"$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; access_log /var/log/nginx/access.log main;
sendfile on; # Enabled compression using the “gzip” method.
keepalive_timeout 60; gzip on;
gzip on;
gzip_disable msie6;
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; gzip_comp_level 3;
# Sets the minimum length of a response that will be gzipped.
gzip_min_length 256; 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 gzip_types
text/css text/css
text/plain text/plain
text/javascript text/javascript
text/cache-manifest text/cache-manifest
text/vcard text/vcard
text/vnd.rim.location.xloc text/vnd.rim.location.xloc
text/vtt text/vtt
text/x-component text/x-component
text/x-cross-domain-policy text/x-cross-domain-policy
application/javascript application/javascript
application/json application/json
application/x-javascript application/x-javascript
application/ld+json application/ld+json
application/xml application/xml
application/xml+rss application/xml+rss
application/xhtml+xml application/xhtml+xml
application/x-font-ttf application/x-font-ttf
application/x-font-opentype application/x-font-opentype
application/vnd.ms-fontobject application/vnd.ms-fontobject
application/manifest+json application/manifest+json
application/rss+xml application/rss+xml
application/atom_xml application/atom_xml
application/vnd.geo+json application/vnd.geo+json
application/x-web-app-manifest+json application/x-web-app-manifest+json
image/svg+xml image/svg+xml
image/x-icon image/x-icon
image/bmp image/bmp
font/opentype; font/opentype;
include /etc/nginx/conf.d/*.conf; include /etc/nginx/conf.d/*.conf;
} }