Skip to content

Commit 84dca41

Browse files
committed
Update nginx config for Trixie
1 parent 879ec46 commit 84dca41

3 files changed

Lines changed: 50 additions & 11 deletions

File tree

overlays/nginx/etc/nginx/sites-available/tkl-default

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# This file will automatically load configuration files provided by other
1313
# applications, such as Drupal or Wordpress. These applications will be made
14-
# available underneath a path with that package name, such as /drupal8.
14+
# available underneath a path with that package name, such as /drupal12.
1515
#
1616
# Please see /usr/share/doc/nginx-doc/examples/ (from Debian nginx-doc
1717
# package) for more detailed examples.
@@ -23,6 +23,9 @@ server {
2323
listen 80 default_server;
2424
listen [::]:80 default_server;
2525

26+
# temporary redirect to https - update to permanent (308) for production
27+
return 307 https://$host$request_uri;
28+
2629
# SSL configuration
2730
listen 443 ssl default_server;
2831
listen [::]:443 ssl default_server;
@@ -44,8 +47,17 @@ server {
4447
# Uncomment to enable PHP-FPM
4548
#include snippets/php-fpm.conf;
4649

47-
# deny access to .htaccess files
48-
location ~ /\.ht {
50+
# Deny access to all dot files
51+
location ~ /\. {
4952
deny all;
53+
access_log off;
54+
log_not_found off;
55+
return 404;
5056
}
57+
# above also disables access to .well-known
58+
# TKL default Let's Encrypt works fine, but other third party tools may
59+
# require this section to be uncommented
60+
#location ^~ /.well-known {
61+
# allow all;
62+
#}
5163
}
Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,42 @@
1-
ssl_certificate /etc/ssl/private/cert.pem;
2-
ssl_certificate_key /etc/ssl/private/cert.key;
3-
ssl_session_timeout 5m;
4-
ssl_session_cache shared:SSL:50m;
1+
ssl_certificate /etc/ssl/private/cert.pem;
2+
ssl_certificate_key /etc/ssl/private/cert.key;
53

6-
ssl_protocols TLSv1.2 TLSv1.3;
4+
http2 on;
75

8-
# ciphers added by conf/turnkey.d/zz-ssl-ciphers script
9-
ssl_ciphers '';
106

11-
ssl_prefer_server_ciphers on;
7+
ssl_protocols TLSv1.2 TLSv1.3;
8+
ssl_ecdh_curve X25519:prime256v1:secp384r1;
9+
# ciphers added by conf/turnkey.d/zz-ssl-ciphers script
10+
ssl_ciphers 'ZZ_SSL_CIPHERS';
11+
ssl_prefer_server_ciphers off;
1212

1313
ssl_dhparam /etc/ssl/private/dhparams.pem;
14+
1415
add_header X-Content-Type-Options nosniff;
1516

17+
# HSTS
18+
add_header Strict-Transport-Security "max-age=63072000" always;
19+
server {
20+
listen 80 default_server;
21+
listen [::]:80 default_server;
22+
23+
return 301 https://$host$request_uri;
24+
}
25+
26+
# see also ssl_session_ticket_key alternative to stateful session cache
27+
ssl_session_timeout 1d;
28+
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
29+
30+
# OCSP stapling (disabled by default)
31+
#ssl_stapling on;
32+
#ssl_stapling_verify on;
33+
# verify chain of trust of OCSP response using Root CA and Intermediate certs
34+
#ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates;
35+
36+
# replace with the IP address of your resolver;
37+
# async 'resolver' is important for proper operation of OCSP stapling
38+
#resolver 127.0.0.1;
39+
# If certificates are marked OCSP Must-Staple, consider managing the
40+
# OCSP stapling cache with an external script, e.g. certbot-ocsp-fetcher
41+
1642
server_tokens off;

plans/turnkey/nginx-php-fpm-mysql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <turnkey/mysql>
22

33
nginx
4+
libnginx-mod-http-modsecurity
45

56
php-fpm
67
php-gd

0 commit comments

Comments
 (0)