2022-04-20 00:29:47 +02:00
|
|
|
load_module "/usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so";
|
|
|
|
worker_processes auto;
|
|
|
|
user nginx nginx;
|
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
2022-05-20 16:31:40 +02:00
|
|
|
types_hash_bucket_size 128;
|
|
|
|
types_hash_max_size 1024;
|
2022-04-20 00:29:47 +02:00
|
|
|
server_names_hash_bucket_size 128;
|
|
|
|
|
2022-07-20 20:06:29 +02:00
|
|
|
absolute_redirect off;
|
|
|
|
|
2022-04-20 00:29:47 +02:00
|
|
|
# Performance optimisation
|
|
|
|
sendfile on;
|
|
|
|
tcp_nopush on;
|
|
|
|
|
|
|
|
# Correct Content-Type header
|
|
|
|
charset utf-8;
|
|
|
|
default_type text/plain;
|
|
|
|
include inc/types.conf;
|
|
|
|
|
|
|
|
# Serve file.gz instead of file if available
|
|
|
|
gzip_static on;
|
|
|
|
|
|
|
|
# Logging
|
2022-11-01 00:25:14 +01:00
|
|
|
map $http_cookie $loggable {
|
2023-02-07 19:52:54 +01:00
|
|
|
"" 0;
|
|
|
|
default 1;
|
2022-11-01 00:25:14 +01:00
|
|
|
}
|
2023-01-29 21:14:36 +01:00
|
|
|
log_format servnest '|$time_local| [$remote_addr]@$server_name {$ssl_protocol $ssl_cipher} $status $body_bytes_sent "$request" "$http_user_agent"';
|
2022-04-20 00:29:47 +02:00
|
|
|
error_log /var/log/nginx/error.log notice;
|
2023-01-29 21:14:36 +01:00
|
|
|
access_log /var/log/nginx/access.log servnest if=$loggable;
|
2022-04-20 00:29:47 +02:00
|
|
|
|
2022-05-20 16:31:40 +02:00
|
|
|
# Disable useless/dangerous features
|
2022-04-20 00:29:47 +02:00
|
|
|
etag off;
|
2022-05-20 16:31:40 +02:00
|
|
|
server_tokens off;
|
|
|
|
more_clear_headers Server;
|
|
|
|
|
|
|
|
# Basic security headers
|
|
|
|
more_set_headers "Referrer-Policy : no-referrer";
|
|
|
|
more_set_headers "Strict-Transport-Security : max-age=94608000; includeSubDomains; preload";
|
|
|
|
more_set_headers "X-Content-Type-Options : nosniff";
|
|
|
|
#more_set_headers "X-XSS-Protection : 1; mode=block";
|
|
|
|
#more_set_headers "X-Download-Options : noopen";
|
|
|
|
#more_set_headers "X-Permitted-Cross-Domain-Policies : none";
|
|
|
|
#more_set_headers "X-Frame-Options : DENY";
|
|
|
|
|
|
|
|
# Basic TLS settings
|
|
|
|
ssl_session_timeout 1d;
|
|
|
|
ssl_session_cache shared:SSL:50m;
|
|
|
|
ssl_session_tickets off;
|
2022-04-20 00:29:47 +02:00
|
|
|
|
2022-10-31 23:58:27 +01:00
|
|
|
# OCSP Stapling
|
|
|
|
#ssl_stapling on;
|
|
|
|
#ssl_stapling_verify on;
|
2023-01-29 21:14:36 +01:00
|
|
|
#ssl_trusted_certificate /etc/letsencrypt/live/servnest.test/chain.pem;
|
2022-10-31 23:58:27 +01:00
|
|
|
|
2022-04-20 00:29:47 +02:00
|
|
|
# Include other configuration
|
|
|
|
include sites/*.conf;
|
2023-01-29 21:14:36 +01:00
|
|
|
include /srv/servnest/nginx/*.conf;
|
2022-04-20 00:29:47 +02:00
|
|
|
}
|