Files
LEMPer/etc/nginx/nginx.conf
2021-07-12 22:21:29 +07:00

105 lines
3.2 KiB
Nginx Configuration File

# Generated by LEMPer.sh
user www-data;
pid /run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 100000;
# Load dynamic modules (requires Nginx to be installed from source).
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 4096;
use epoll;
multi_accept on;
}
http {
# Hide nginx version information.
server_tokens off;
etag off;
# Override server name, requires headers-more-nginx-module enabled.
#more_set_headers "Server: LEMPer";
# Default MIME types for files.
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Charset.
include /etc/nginx/charset;
# Limits request (simple DDoS defense).
limit_req_log_level warn;
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=10r/s;
# Logging format.
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$gzip_ratio"'
' "$connection" "$connection_requests" "$request_time"';
# To boost I/O on HDD we can disable access logs by default, should be enabled per vhost.
access_log off;
# Default error log set to debug level, should be configured per vhost.
error_log /var/log/nginx/error.log debug;
# Cache informations about FDs, frequently accessed files.
# can boost performance, but you need to test those values.
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
# Optimization settings.
aio threads;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
client_body_buffer_size 128k;
client_header_buffer_size 32k;
large_client_header_buffers 4 256k;
client_max_body_size 20m;
types_hash_max_size 2048;
# Connection tuning.
reset_timedout_connection on;
client_body_timeout 10s;
client_header_timeout 10s;
send_timeout 2s;
keepalive_timeout 30s;
keepalive_requests 100000;
# Enable Compression.
# gzip (default) or brotli (requires Nginx installed with brotli module).
#include /etc/nginx/comp_gzip;
# Uncomment to enable FastCGI cache. If disabled, do not use the cached vhost setting.
include /etc/nginx/fastcgi_cache;
# Uncomment to enable Proxy cache. Enables only if Nginx runs as proxy server.
#include /etc/nginx/proxy_cache;
# Upstream, ex: for Node.JS application server.
include /etc/nginx/upstream;
# SSL map.
include /etc/nginx/fastcgi_https_map;
# Let NGINX get the real client IP for its access logs. You can move this to server{} block.
# Uncomment if you're using frontend http accelerator or loadbalancer such as haproxy/varnish.
#include /etc/nginx/http_proxy_ips;
# Uncomment if you're using CloudFlare CDN.
include /etc/nginx/http_cloudflare_ips;
# Mod Ngx_PageSpeed, requires Nginx installed with ngx-pagespeed module.
#include /etc/nginx/mod_pagespeed;
# Load vhost configs.
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}