Files
LEMPer/nginx/nginx.conf
2019-05-09 23:18:31 +07:00

107 lines
3.7 KiB
Nginx Configuration File

user www-data;
worker_processes auto;
worker_rlimit_nofile 100000;
pid /run/nginx.pid;
# Load dynamic modules (Install 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;
# Define the MIME types for files.
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Update charset_types due to updated mime.types
charset_types text/css text/plain text/vnd.wap.wml application/javascript application/json application/rss+xml application/xml;
# Format to use in log files.
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"';
access_log /var/log/nginx/access.log combined buffer=32k;
error_log /var/log/nginx/error.log debug;
# Optimized settings.
keepalive_timeout 60;
keepalive_requests 100000;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_names_hash_max_size 128;
server_names_hash_bucket_size 128;
client_header_buffer_size 128k;
client_body_buffer_size 128k;
client_body_in_file_only off;
client_max_body_size 32m;
connection_pool_size 256;
ignore_invalid_headers on;
large_client_header_buffers 4 4k;
output_buffers 1 32k;
postpone_output 1460;
request_pool_size 32k;
#map_hash_bucket_size 64;
#types_hash_max_size 2048;
client_header_timeout 60s;
client_body_timeout 60s;
send_timeout 60s;
reset_timedout_connection on;
# Uncomment for nginx proxy backends to prevent redirects to backend port.
#port_in_redirect off;
# Cache informations about FDs, frequently accessed files.
# can boost performance, but you need to test those values.
open_file_cache max=1024 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
# Enable Gzip Compression.
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
#gzip_buffers 16 8k;
# Compress all output labeled with one of the following MIME-types.
# You can remove image/png image/x-icon image/gif image/jpeg if you have slow CPU.
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rdf+xml application/x-javascript application/xml application/xml+rss font/eot font/opentype image/bmp image/gif image/jpeg image/png image/svg+xml image/vnd.microsoft.icon image/x-icon text/cache-manifest text/css text/javascript text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy text/xml;
# text/html is always compressed by HttpGzipModule
# Enable FastCGI and Proxy Cache.
# 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.conf;
# 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 frontend CloudFlare CDN
include /etc/nginx/http_cloudflare_ips;
## Virtual Host configs
index index.php index.html index.htm;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}