From c25c357e92ef669772e532d3faecdc799e6925ee Mon Sep 17 00:00:00 2001 From: PiotrBracha <52270680+PiotrBracha@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:57:05 +0200 Subject: [PATCH 1/2] Update nginx.md Few improvements inside the Nginx's configuration. --- basics/installation/advanced/nginx.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/basics/installation/advanced/nginx.md b/basics/installation/advanced/nginx.md index 568b22ff44..0c4c5053fa 100644 --- a/basics/installation/advanced/nginx.md +++ b/basics/installation/advanced/nginx.md @@ -26,8 +26,8 @@ server { server_name example.com www.example.com; # [EDIT] Path to your domain Nginx logs. - access_log /var/log/nginx/example.com-access.log; - error_log /var/log/nginx/example.com-error.log; + access_log /var/log/nginx/example.com-access.log combined; + error_log /var/log/nginx/example.com-error.log info; # [EDIT] Path to your SSL certificates (take a look at Certbot https://certbot.eff.org). ssl_certificate /etc/ssl/fullchain.pem; @@ -50,6 +50,19 @@ server { # WARNING: Don't use this if your site is not fully on HTTPS! # add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" preload; always; + # XSS Protection + # add_header X-XSS-Protection "1; mode=block"; + + # Clickjacking + # add_header X-Frame-Options "SAMEORIGIN"; + + # X-Content Type Options + # add_header X-Content-Type-Options nosniff; + + # Secure Cookie + # add_header Set-Cookie "Path=/; HttpOnly; Secure"; + + # [EDIT] If you are using multiple languages. # rewrite ^/fr$ /fr/ redirect; # rewrite ^/fr/(.*) /$1; @@ -80,11 +93,10 @@ server { # [EDIT] Replace 'admin-dev' in this block with the name of your admin directory. location /admin-dev/ { - if (!-e $request_filename) { - rewrite ^ /admin-dev/index.php last; - } + try_files $uri $uri/ /admin-dev/index.php$is_args$args; } + # .htaccess, .DS_Store, .htpasswd, etc. location ~ /\. { deny all; From 626a54f564d536310be0ca3240cd48e5e3cf36d9 Mon Sep 17 00:00:00 2001 From: Krystian Podemski Date: Thu, 28 Dec 2023 11:46:40 +0100 Subject: [PATCH 2/2] Apply suggestions from code review --- basics/installation/advanced/nginx.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/basics/installation/advanced/nginx.md b/basics/installation/advanced/nginx.md index 0c4c5053fa..dda71b63ca 100644 --- a/basics/installation/advanced/nginx.md +++ b/basics/installation/advanced/nginx.md @@ -26,7 +26,9 @@ server { server_name example.com www.example.com; # [EDIT] Path to your domain Nginx logs. + # more details: https://docs.nginx.com/nginx/admin-guide/monitoring/logging/#setting-up-the-access-log access_log /var/log/nginx/example.com-access.log combined; + # more details: https://nginx.org/en/docs/ngx_core_module.html?#error_log error_log /var/log/nginx/example.com-error.log info; # [EDIT] Path to your SSL certificates (take a look at Certbot https://certbot.eff.org).