nginx.conf
· 2.5 KiB · Nginx configuration file
Raw
user www-data;
worker_processes auto;
worker_cpu_affinity auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
worker_rlimit_nofile 409600;
events {
use epoll;
worker_connections 204800;
multi_accept on;
}
http {
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
client_max_body_size 100m;
server_names_hash_bucket_size 64;
server_name_in_redirect off;
variables_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
#Brotli Compression
brotli on;
brotli_comp_level 6;
brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
##
# Nginx Cache Settings
##
# proxy_temp_file_write_size 128k;
# proxy_temp_path /mnt/cache/nginx/cache/temp;
# proxy_cache_path /mnt/cache/nginx/cache/cache_1 levels=1:2 keys_zone=cache_1:50m inactive=30d max_size=450g;
# proxy_cache_path /mnt/cache/nginx/cache/cache_2 levels=1:2 keys_zone=cache_2:50m inactive=30d max_size=450g;
# proxy_cache_path /mnt/cache/nginx/cache/cache_3 levels=1:2 keys_zone=cache_3:50m inactive=30d max_size=450g;
# proxy_cache_path /mnt/cache/nginx/cache/cache_4 levels=1:2 keys_zone=cache_4:50m inactive=30d max_size=450g;
# proxy_cache_path /mnt/cache/nginx/cache/cache_5 levels=1:2 keys_zone=cache_5:50m inactive=30d max_size=450g;
##
# Rate limiting
#
limit_req_zone $binary_remote_addr zone=limit_1:50m rate=5r/s;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# Virtual Host Configs
##
http2 on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
1 | user www-data; |
2 | worker_processes auto; |
3 | worker_cpu_affinity auto; |
4 | pid /run/nginx.pid; |
5 | include /etc/nginx/modules-enabled/*.conf; |
6 | |
7 | worker_rlimit_nofile 409600; |
8 | events { |
9 | use epoll; |
10 | worker_connections 204800; |
11 | multi_accept on; |
12 | } |
13 | |
14 | http { |
15 | |
16 | open_file_cache max=200000 inactive=20s; |
17 | open_file_cache_valid 30s; |
18 | open_file_cache_min_uses 2; |
19 | open_file_cache_errors on; |
20 | |
21 | ## |
22 | # Basic Settings |
23 | ## |
24 | |
25 | sendfile on; |
26 | tcp_nopush on; |
27 | tcp_nodelay on; |
28 | keepalive_timeout 65; |
29 | types_hash_max_size 2048; |
30 | server_tokens off; |
31 | client_max_body_size 100m; |
32 | |
33 | server_names_hash_bucket_size 64; |
34 | server_name_in_redirect off; |
35 | |
36 | variables_hash_max_size 2048; |
37 | |
38 | include /etc/nginx/mime.types; |
39 | default_type application/octet-stream; |
40 | |
41 | ## |
42 | # Logging Settings |
43 | ## |
44 | |
45 | access_log /var/log/nginx/access.log; |
46 | error_log /var/log/nginx/error.log; |
47 | |
48 | ## |
49 | # Gzip Settings |
50 | ## |
51 | |
52 | gzip on; |
53 | gzip_disable "msie6"; |
54 | |
55 | gzip_vary on; |
56 | gzip_proxied any; |
57 | gzip_comp_level 6; |
58 | gzip_buffers 16 8k; |
59 | gzip_http_version 1.1; |
60 | gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; |
61 | |
62 | #Brotli Compression |
63 | brotli on; |
64 | brotli_comp_level 6; |
65 | brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml; |
66 | |
67 | ## |
68 | # Nginx Cache Settings |
69 | ## |
70 | |
71 | # proxy_temp_file_write_size 128k; |
72 | # proxy_temp_path /mnt/cache/nginx/cache/temp; |
73 | # proxy_cache_path /mnt/cache/nginx/cache/cache_1 levels=1:2 keys_zone=cache_1:50m inactive=30d max_size=450g; |
74 | # proxy_cache_path /mnt/cache/nginx/cache/cache_2 levels=1:2 keys_zone=cache_2:50m inactive=30d max_size=450g; |
75 | # proxy_cache_path /mnt/cache/nginx/cache/cache_3 levels=1:2 keys_zone=cache_3:50m inactive=30d max_size=450g; |
76 | # proxy_cache_path /mnt/cache/nginx/cache/cache_4 levels=1:2 keys_zone=cache_4:50m inactive=30d max_size=450g; |
77 | # proxy_cache_path /mnt/cache/nginx/cache/cache_5 levels=1:2 keys_zone=cache_5:50m inactive=30d max_size=450g; |
78 | |
79 | ## |
80 | # Rate limiting |
81 | # |
82 | limit_req_zone $binary_remote_addr zone=limit_1:50m rate=5r/s; |
83 | |
84 | ## |
85 | # nginx-naxsi config |
86 | ## |
87 | # Uncomment it if you installed nginx-naxsi |
88 | ## |
89 | |
90 | #include /etc/nginx/naxsi_core.rules; |
91 | |
92 | ## |
93 | # Virtual Host Configs |
94 | ## |
95 | |
96 | http2 on; |
97 | |
98 | include /etc/nginx/conf.d/*.conf; |
99 | include /etc/nginx/sites-enabled/*; |
100 | } |
101 | |
102 |