Skip to content

Instantly share code, notes, and snippets.

@ZephiroRB
Last active April 4, 2021 05:15
Show Gist options
  • Save ZephiroRB/901daafa823fca547416b9ad9db60fe7 to your computer and use it in GitHub Desktop.
Save ZephiroRB/901daafa823fca547416b9ad9db60fe7 to your computer and use it in GitHub Desktop.
user www-data;
worker_processes 4;#nproc lscpu
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024; #ulimit -n
multi_accept on;
use epoll;
}
http {
limit_req_zone $http_cf_connecting_ip zone=ip:10m rate=3r/s;
limit_req zone=ip;
limit_conn_status 429;
limit_req_status 429;
##
# Basic Settings
##
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
keepalive_timeout 300;
types_hash_max_size 2048;
#HIDDEN TOKEN
server_tokens off;
#FILES CACHE
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
large_client_header_buffers 4 8m;
client_header_buffer_size 1k;
client_body_buffer_size 10M;
client_max_body_size 10M;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
add_header Alternate-Protocol 443:npn-spdy/3;
# Prevent mobile providers modding site
add_header "Cache-Control" "no-transform";
# XFrame Options
add_header X-Frame-Options SAMEORIGIN;
add_header Strict-Transport-Security "max-age=86400";
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
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_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;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment