Prevent nginx HTTP Server Detection

Signed-off-by: Jan Kiesewetter <jan@t3easy.de>
This commit is contained in:
Jan Kiesewetter
2022-03-02 11:38:33 +01:00
parent d1b8c3b0c7
commit 261d6dafe4
2 changed files with 12 additions and 0 deletions

View File

@@ -15,6 +15,9 @@ server {
listen [::]:80;
server_name cloud.example.com;
# Prevent nginx HTTP Server Detection
server_tokens off;
# Enforce HTTPS
return 301 https://$server_name$request_uri;
}
@@ -32,6 +35,9 @@ server {
ssl_certificate /etc/ssl/nginx/cloud.example.com.crt;
ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key;
# Prevent nginx HTTP Server Detection
server_tokens off;
# HSTS settings
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option

View File

@@ -14,6 +14,9 @@ server {
listen [::]:80;
server_name cloud.example.com;
# Prevent nginx HTTP Server Detection
server_tokens off;
# Enforce HTTPS just for `/nextcloud`
location /nextcloud {
return 301 https://$server_name$request_uri;
@@ -33,6 +36,9 @@ server {
ssl_certificate /etc/ssl/nginx/cloud.example.com.crt;
ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key;
# Prevent nginx HTTP Server Detection
server_tokens off;
# HSTS settings
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option