2017-12-14 05:51:37 +01:00
|
|
|
user www-data;
|
|
|
|
worker_processes auto;
|
2017-12-15 17:39:24 +01:00
|
|
|
worker_cpu_affinity auto;
|
2017-12-17 22:32:47 +01:00
|
|
|
worker_rlimit_nofile 100000;
|
2017-12-14 05:51:37 +01:00
|
|
|
pid /run/nginx.pid;
|
|
|
|
|
2018-12-19 13:39:09 +01:00
|
|
|
pcre_jit on;
|
|
|
|
|
2019-04-03 10:40:32 +02:00
|
|
|
events {
|
2018-12-19 13:39:09 +01:00
|
|
|
multi_accept on;
|
2018-11-30 17:42:55 +01:00
|
|
|
worker_connections 50000;
|
2019-02-20 18:22:54 +01:00
|
|
|
accept_mutex on;
|
2018-03-05 20:35:09 +01:00
|
|
|
use epoll;
|
2017-12-14 05:51:37 +01:00
|
|
|
}
|
|
|
|
|
2018-03-05 20:35:09 +01:00
|
|
|
http
|
|
|
|
{
|
|
|
|
##
|
|
|
|
# EasyEngine Settings
|
|
|
|
##
|
|
|
|
|
|
|
|
sendfile on;
|
2018-09-12 20:51:59 +02:00
|
|
|
sendfile_max_chunk 512k;
|
|
|
|
|
2018-03-05 20:35:09 +01:00
|
|
|
tcp_nopush on;
|
|
|
|
tcp_nodelay on;
|
2018-09-12 20:51:59 +02:00
|
|
|
|
|
|
|
keepalive_timeout 8;
|
|
|
|
keepalive_requests 500;
|
2018-11-30 17:42:55 +01:00
|
|
|
keepalive_disable msie6;
|
2018-09-12 20:51:59 +02:00
|
|
|
|
|
|
|
lingering_time 20s;
|
|
|
|
lingering_timeout 5s;
|
2018-03-05 20:35:09 +01:00
|
|
|
|
|
|
|
server_tokens off;
|
|
|
|
reset_timedout_connection on;
|
2019-03-19 13:47:45 +01:00
|
|
|
add_header X-Powered-By "WordOps v3.9.4 - Optimized by VirtuBox";
|
2018-03-05 20:35:09 +01:00
|
|
|
add_header rt-Fastcgi-Cache $upstream_cache_status;
|
|
|
|
|
|
|
|
# Limit Request
|
|
|
|
limit_req_status 403;
|
2018-05-28 02:40:37 +02:00
|
|
|
limit_req_zone $remote_addr_ipscrub zone=one:10m rate=1r/s;
|
2018-03-05 20:35:09 +01:00
|
|
|
|
2018-10-13 15:04:41 +02:00
|
|
|
##
|
|
|
|
# Simple DOS mitigation
|
|
|
|
##
|
|
|
|
|
|
|
|
# Max c/s by ip
|
2018-04-14 18:59:50 +02:00
|
|
|
#limit_conn_zone $binary_remote_addr zone=limit_per_ip:10m;
|
|
|
|
#limit_conn limit_per_ip 80;
|
2018-03-05 20:35:09 +01:00
|
|
|
|
2018-10-13 15:04:41 +02:00
|
|
|
# Max rq/s by ip
|
2018-04-14 18:59:50 +02:00
|
|
|
#limit_req_zone $binary_remote_addr zone=allips:10m rate=400r/s;
|
|
|
|
#limit_req zone=allips burst=400 nodelay;
|
2018-03-05 20:35:09 +01:00
|
|
|
|
|
|
|
# Proxy Settings
|
|
|
|
# set_real_ip_from proxy-server-ip;
|
|
|
|
# real_ip_header X-Forwarded-For;
|
|
|
|
|
|
|
|
fastcgi_read_timeout 120s;
|
|
|
|
client_max_body_size 100m;
|
|
|
|
|
2018-10-13 15:04:41 +02:00
|
|
|
# See - https://www.nginx.com/blog/thread-pools-boost-performance-9x/
|
2018-03-05 20:35:09 +01:00
|
|
|
aio threads;
|
2018-09-04 15:38:41 +02:00
|
|
|
|
2018-03-05 21:20:55 +01:00
|
|
|
# tls dynamic records patch directive
|
2018-11-04 13:51:37 +01:00
|
|
|
ssl_dyn_rec_enable on;
|
|
|
|
ssl_dyn_rec_size_hi 4229;
|
|
|
|
ssl_dyn_rec_size_lo 1369;
|
|
|
|
ssl_dyn_rec_threshold 40;
|
|
|
|
ssl_dyn_rec_timeout 1000;
|
2018-09-04 15:38:41 +02:00
|
|
|
|
2018-07-13 09:47:37 +02:00
|
|
|
# nginx-vts-status module
|
2018-09-04 15:38:41 +02:00
|
|
|
vhost_traffic_status_zone;
|
|
|
|
|
2018-10-13 15:04:41 +02:00
|
|
|
# oscp settings
|
2018-07-13 09:47:37 +02:00
|
|
|
resolver 8.8.8.8 1.1.1.1 valid=300s;
|
|
|
|
resolver_timeout 10;
|
2018-03-05 20:35:09 +01:00
|
|
|
|
|
|
|
##
|
|
|
|
# GeoIP module configuration, before removing comments
|
|
|
|
# read the tutorial : https://gist.github.com/VirtuBox/9ed03c9bd9169202c358a8be181b7840
|
|
|
|
##
|
|
|
|
#geoip_country /usr/share/GeoIP/GeoIP.dat;
|
|
|
|
#geoip_city /usr/share/GeoIP/GeoIPCity.dat;
|
|
|
|
|
|
|
|
##
|
|
|
|
# SSL Settings
|
|
|
|
##
|
2018-11-04 13:51:37 +01:00
|
|
|
|
|
|
|
# SSL Early Data
|
|
|
|
ssl_early_data off;
|
|
|
|
|
2018-03-05 20:35:09 +01:00
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
2019-04-04 14:09:37 +02:00
|
|
|
ssl_ciphers 'TLS13+AESGCM+AES128:TLS13+AESGCM+AES256:TLS13+CHACHA20:EECDH+AESGCM:EECDH+CHACHA20';
|
2018-03-05 20:35:09 +01:00
|
|
|
ssl_prefer_server_ciphers on;
|
2018-03-05 21:20:55 +01:00
|
|
|
ssl_session_cache shared:SSL:50m;
|
|
|
|
ssl_session_timeout 1d;
|
2018-03-05 20:35:09 +01:00
|
|
|
ssl_session_tickets off;
|
2018-09-03 18:39:32 +02:00
|
|
|
ssl_ecdh_curve X25519:sect571r1:secp521r1:secp384r1;
|
2018-09-04 15:38:41 +02:00
|
|
|
|
2018-10-13 15:04:41 +02:00
|
|
|
# Common security headers
|
2018-03-05 20:35:09 +01:00
|
|
|
more_set_headers "X-Frame-Options : SAMEORIGIN";
|
|
|
|
more_set_headers "X-Xss-Protection : 1; mode=block";
|
|
|
|
more_set_headers "X-Content-Type-Options : nosniff";
|
|
|
|
more_set_headers "Referrer-Policy : strict-origin-when-cross-origin";
|
2019-02-20 15:09:42 +01:00
|
|
|
more_set_headers "X-Download-Options : noopen";
|
2019-04-04 14:09:37 +02:00
|
|
|
|
2018-03-05 20:35:09 +01:00
|
|
|
##
|
|
|
|
# Basic Settings
|
|
|
|
##
|
|
|
|
# server_names_hash_bucket_size 64;
|
|
|
|
# server_name_in_redirect off;
|
|
|
|
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
default_type application/octet-stream;
|
|
|
|
|
|
|
|
##
|
|
|
|
# Logging Settings
|
|
|
|
##
|
|
|
|
|
2018-10-13 15:04:41 +02:00
|
|
|
# disable access_log for performance
|
2018-03-05 20:35:09 +01:00
|
|
|
access_log off;
|
|
|
|
error_log /var/log/nginx/error.log;
|
|
|
|
|
2018-10-13 15:04:41 +02:00
|
|
|
# Log format Settings - user IP hashed with the module ipscrub
|
2018-05-28 02:40:37 +02:00
|
|
|
log_format rt_cache '$remote_addr_ipscrub $upstream_response_time $upstream_cache_status [$time_local] '
|
2018-03-05 20:35:09 +01:00
|
|
|
'$http_host "$request" $status $body_bytes_sent '
|
2018-05-28 02:40:37 +02:00
|
|
|
'"$http_referer" "$http_user_agent" $server_protocol';
|
2018-09-04 15:38:41 +02:00
|
|
|
|
2018-05-28 02:40:37 +02:00
|
|
|
# ipscrub settings
|
|
|
|
ipscrub_period_seconds 3600;
|
2018-03-05 20:35:09 +01:00
|
|
|
|
|
|
|
##
|
|
|
|
# Gzip Settings
|
|
|
|
##
|
2019-02-20 15:09:42 +01:00
|
|
|
# mitigation of CRIME/BREACH attacks
|
|
|
|
gzip off;
|
2018-03-05 20:35:09 +01:00
|
|
|
|
|
|
|
##
|
|
|
|
# Brotli Settings
|
|
|
|
##
|
|
|
|
|
|
|
|
brotli on;
|
|
|
|
brotli_static on;
|
|
|
|
brotli_buffers 16 8k;
|
2018-12-19 13:39:09 +01:00
|
|
|
brotli_comp_level 4;
|
2018-03-05 20:35:09 +01:00
|
|
|
brotli_types *;
|
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
# Virtual Host Configs
|
|
|
|
##
|
|
|
|
include /etc/nginx/conf.d/*.conf;
|
|
|
|
include /etc/nginx/sites-enabled/*;
|
2017-12-14 05:51:37 +01:00
|
|
|
}
|
|
|
|
|
2018-01-15 19:08:34 +01:00
|
|
|
|
|
|
|
#mail {
|
|
|
|
# # See sample authentication script at:
|
|
|
|
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
|
|
|
|
#
|
|
|
|
# # auth_http localhost/auth.php;
|
|
|
|
# # pop3_capabilities "TOP" "USER";
|
|
|
|
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
|
|
|
|
#
|
|
|
|
# server {
|
|
|
|
# listen localhost:110;
|
|
|
|
# protocol pop3;
|
|
|
|
# proxy on;
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# server {
|
|
|
|
# listen localhost:143;
|
|
|
|
# protocol imap;
|
|
|
|
# proxy on;
|
|
|
|
# }
|
2018-03-18 23:22:42 +01:00
|
|
|
#}
|