Skip to content

Instantly share code, notes, and snippets.

@muratgozel
Last active June 4, 2021 14:47
Show Gist options
  • Save muratgozel/99b1499d264992382c53d9ab4d33cfe0 to your computer and use it in GitHub Desktop.
Save muratgozel/99b1499d264992382c53d9ab4d33cfe0 to your computer and use it in GitHub Desktop.
user nginx;
worker_processes auto;
error_log syslog:server=unix:/dev/log notice;
pid /var/run/nginx.pid;
#load_module modules/ngx_http_brotli_filter_module.so;
#load_module modules/ngx_http_brotli_static_module.so;
events {
worker_connections 1024;
multi_accept on;
accept_mutex on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# only log unsuccessful requests
map $status $log_access {
~^[23] 0;
default 1;
}
access_log syslog:server=unix:/dev/log,nohostname main if=$log_access;
# keep requested filename in the $request_basename var
map $request_uri $request_basename {
~/(?<captured_request_basename>[^/?]*)(?:\?|$) $captured_request_basename;
}
sendfile on;
sendfile_max_chunk 512k;
tcp_nodelay on;
tcp_nopush on;
server_tokens off;
client_body_buffer_size 10k;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;
keepalive_timeout 30;
keepalive_requests 100;
client_body_timeout 10;
client_header_timeout 10;
reset_timedout_connection on;
send_timeout 2;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_comp_level 6;
gzip_min_length 250;
gzip_types
text/plain text/css application/javascript application/x-javascript
text/xml application/xml+rss application/xml text/javascript
application/json image/x-icon image/vnd.microsoft.icon image/bmp image/svg+xml;
#brotli on;
#brotli_comp_level 6;
#brotli_buffers 32 8k;
#brotli_min_length 100;
#brotli_static on;
#brotli_types
# text/plain text/css application/javascript application/x-javascript
# text/xml application/xml application/xml+rss text/javascript application/json
# image/x-icon image/vnd.microsoft.icon image/bmp image/svg+xml;
include /etc/nginx/conf.d/*.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment