diff --git a/002-searx.conf b/002-searx.conf index 4616062..b9d6702 100644 --- a/002-searx.conf +++ b/002-searx.conf @@ -27,36 +27,6 @@ server { } } -server { - listen 443 ssl http2; - server_name www.searx.solusar.de; - - location / { - return 301 https://searx.solusar.de$request_uri; - } - - #ssl on; - ssl_certificate /etc/letsencrypt/live/searx.solusar.de/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/searx.solusar.de/privkey.pem; - ssl_trusted_certificate /etc/letsencrypt/live/searx.solusar.de/fullchain.pem; - - ssl_dhparam /etc/myssl/dh4096.pem; - ssl_protocols TLSv1.2; - ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK'; - ssl_session_timeout 5m; - ssl_prefer_server_ciphers on; - ssl_session_cache shared:SSL:50m; - - add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; - #add_header Content-Security-Policy "default-src 'self'; img-src 'self' data: http: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' http: https:; font-src 'self' data: http: https:; object-src 'none';"; - add_header Content-Security-Policy "default-src 'none'; font-src 'self'; script-src 'self' https://searx.solusar.de; img-src * data:; object-src 'none'; style-src 'self' 'sha256-bQfd5MwpJ1ZxnVh373acxlqXQ8VwM88QhEHNuQ0ppNg='; frame-src 'self'; connect-src 'self'; form-action 'self'; base-uri 'self';frame-ancestors 'self';"; - - # default-src 'none'; font-src 'self'; script-src 'self' 'sha256-IP0Wu+32AyU/oDc6ZoLyf8izu/2fUvR7RAEf81sddNk='; img-src * data:; object-src 'none'; style-src 'self' 'sha256-PEo9RAB0C7Pw0EzsgS+HuVOHFPZRr93dZNJ9mYzz95A=' 'sha256-lrhGtO62QsLjBNsk1WGpvRZbHmXYMG/CmjhMFhLDJpg=' 'sha256-4SHcbKIX1Fx5rhlottWqqHggM5MSJz+xg9uwwq8UK74=' 'sha256-bQfd5MwpJ1ZxnVh373acxlqXQ8VwM88QhEHNuQ0ppNg=' 'sha256-yIJ6JcbosmUis6IDdnDV7NU2qPkU/1KUJHRwj44Q32o='; frame-src 'self'; connect-src 'self'; form-action 'self'; base-uri 'self';frame-ancestors 'self'; report-uri https://csp.itronic.at/report.php; -} - server { #listen 80; listen 443 ssl http2; diff --git a/003-postfix.conf b/003-postfix.conf index ca69dae..673d193 100644 --- a/003-postfix.conf +++ b/003-postfix.conf @@ -13,32 +13,6 @@ server { } } -server { - listen 443 ssl http2; - server_name www.postfix.solusar.de; - - location / { - return 301 https://postfix.solusar.de$request_uri; - } - - #ssl on; - ssl_certificate /etc/letsencrypt/live/postfix.solusar.de/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/postfix.solusar.de/privkey.pem; - ssl_trusted_certificate /etc/letsencrypt/live/postfix.solusar.de/fullchain.pem; - - ssl_dhparam /etc/myssl/dh4096.pem; - ssl_protocols TLSv1.2; - ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK'; - ssl_session_timeout 5m; - ssl_prefer_server_ciphers on; - ssl_session_cache shared:SSL:50m; - - add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; -} - server { listen 443 ssl http2; diff --git a/004-diaspora.conf.save b/004-diaspora.conf.save deleted file mode 100644 index 582623b..0000000 --- a/004-diaspora.conf.save +++ /dev/null @@ -1,125 +0,0 @@ -server { - listen 80; - server_name diaspora.solusar.de www.diaspora.example.org; - - location / { - return 301 https://$server_name$request_uri; - } -} - - # Redirect https://www.diaspora.example.org to https://diaspora.example.org -server { - listen 443 ssl spdy; # Same rules as for listen [::]:80 apply. - - server_name www.diaspora.solusar.de; - - location / { - return 301 https://diaspora.solusar.de$request_uri; - } - - # SSL setup - - # This file should also include any necessary intermediate certificates. - # For example for StartSSL that would be https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem - # For Let's Encrypt use /etc/letsencrypt/live/diaspora.example.org/fullchain.pem - # and /etc/letsencrypt/diaspora.example.org/privkey.pem - ssl_certificate /etc/letsencrypt/live/diaspora.solusar.de/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/diaspora.solusar.de/privkey.pem; - ssl_trusted_certificate /etc/letsencrypt/live/diaspora.solusar.de/fullchain.pem; - - # Taken from https://wiki.mozilla.org/Security/Server_Side_TLS - # You might want to make these global - - # generate with openssl dhparam 2048 > /path/to/dhparam.pem - ssl_dhparam /etc/myssl/dh4096.pem; - ssl_protocols TLSv1.2; - ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK'; - ssl_session_timeout 5m; - ssl_prefer_server_ciphers on; - ssl_session_cache shared:SSL:50m; - - add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; -} - - # Actual proxy - -server { - listen 443 ssl spdy; # Same rules as for listen [::]:80 apply. - server_name diaspora.solusar.de; - root /home/diaspora/diaspora/public; - - access_log /var/log/nginx/004-diaspora-access.log; - error_log /var/log/nginx/004-diaspora-error.log; - - # Configure maximum picture size - # Note that Diaspora has a client side check set at 4M - client_max_body_size 10M; - client_body_buffer_size 512K; - - # SSL setup - - # This file should also include any necessary intermediate certificates. - # For example for StartSSL that would be https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem - # For Let's Encrypt use /etc/letsencrypt/live/diaspora.example.org/fullchain.pem - # and /etc/letsencrypt/diaspora.example.org/privkey.pem - ssl_certificate /etc/letsencrypt/live/diaspora.solusar.de/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/diaspora.solusar.de/privkey.pem; - ssl_trusted_certificate /etc/letsencrypt/live/diaspora.solusar.de/fullchain.pem; - - # Taken from https://wiki.mozilla.org/Security/Server_Side_TLS - # You might want to make these global - - # generate with openssl dhparam 2048 > /path/to/dhparam.pem - ssl_dhparam /etc/myssl/dh4096.pem; - ssl_protocols TLSv1.2; - ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK'; - ssl_session_timeout 5m; - ssl_prefer_server_ciphers on; - ssl_session_cache shared:SSL:50m; - - add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; - - # Proxy if requested file not found - try_files $uri @diaspora; - - location /assets/ { - expires max; - add_header Cache-Control public; - } - - # Camo support - #location /camo/ { - # proxy_redirect off; - # proxy_pass http://camo/; - # break; - #} - - location @diaspora { - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto https; - proxy_set_header Host $http_host; - proxy_redirect off; - - proxy_pass http://localhost:3000; - } -} - - # Proxy destination - # Add as many server directives as you want - # Also takes a socket, like unix:/path/to/some/socket.sock -#upstream diaspora_server { -# server unix:/home/diaspora/diaspora/tmp/diaspora.sock; -#} - -# Camo support -#upstream camo { -# server 127.0.0.1:8081; -#} - diff --git a/007-indra.conf b/007-indra.conf index 2687e71..6eba126 100644 --- a/007-indra.conf +++ b/007-indra.conf @@ -13,32 +13,6 @@ server { } } -server { - listen 443 ssl http2; # Same rules as for listen [::]:80 apply. - server_name www.indra.solusar.de; - - location / { - return 301 https://indra.solusar.de$request_uri; - } - - #ssl on; - ssl_certificate /etc/letsencrypt/live/indra.solusar.de/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/indra.solusar.de/privkey.pem; - ssl_trusted_certificate /etc/letsencrypt/live/indra.solusar.de/fullchain.pem; - - ssl_dhparam /etc/myssl/dh4096.pem; - ssl_protocols TLSv1.2; - ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK'; - ssl_session_timeout 5m; - ssl_prefer_server_ciphers on; - ssl_session_cache shared:SSL:50m; - - add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; -} - server { listen 443 ssl http2; diff --git a/008-wiki.conf b/008-wiki.conf index e7d2ce5..9a19af8 100644 --- a/008-wiki.conf +++ b/008-wiki.conf @@ -13,32 +13,6 @@ server { } } -server { - listen 443 ssl http2; # Same rules as for listen [::]:80 apply. - server_name www.wiki.solusar.de; - - location / { - return 301 https://wiki.solusar.de$request_uri; - } - - #ssl on; - ssl_certificate /etc/letsencrypt/live/wiki.solusar.de/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/wiki.solusar.de/privkey.pem; - ssl_trusted_certificate /etc/letsencrypt/live/wiki.solusar.de/fullchain.pem; - - ssl_dhparam /etc/myssl/dh4096.pem; - ssl_protocols TLSv1.2; - ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK'; - ssl_session_timeout 5m; - ssl_prefer_server_ciphers on; - ssl_session_cache shared:SSL:50m; - - add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; -} - server { listen 443 ssl http2; diff --git a/009-webmail.conf b/009-webmail.conf index 5cd97c1..1eadcd1 100644 --- a/009-webmail.conf +++ b/009-webmail.conf @@ -1,7 +1,7 @@ ## -# POSTFIX site +# webmail site ## server { @@ -13,32 +13,6 @@ server { } } -server { - listen 443 ssl http2; # Same rules as for listen [::]:80 apply. - server_name www.webmail.solusar.de; - - location / { - return 301 https://webmail.solusar.de$request_uri; - } - - #ssl on; - ssl_certificate /etc/letsencrypt/live/webmail.solusar.de/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/webmail.solusar.de/privkey.pem; - ssl_trusted_certificate /etc/letsencrypt/live/webmail.solusar.de/fullchain.pem; - - ssl_dhparam /etc/myssl/dh4096.pem; - ssl_protocols TLSv1.2; - ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK'; - ssl_session_timeout 5m; - ssl_prefer_server_ciphers on; - ssl_session_cache shared:SSL:50m; - - add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; -} - server { listen 443 ssl http2; diff --git a/010-gitea.conf b/010-gitea.conf index c7e2cb1..143fad9 100644 --- a/010-gitea.conf +++ b/010-gitea.conf @@ -1,9 +1,5 @@ -## -# POSTFIX site -## - server { listen 80; server_name gitea.solusar.de www.gitea.solusar.de; diff --git a/012-nextcloud.conf b/012-nextcloud.conf new file mode 100644 index 0000000..532450d --- /dev/null +++ b/012-nextcloud.conf @@ -0,0 +1,167 @@ +upstream php-handler { + #server 127.0.0.1:9000; + server unix:/var/run/php/php7.4-fpm.sock; +} + +server { + listen 80; + listen [::]:80; + server_name nc.solusar.de; + + # Enforce HTTPS + return 301 https://$server_name$request_uri; +} + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name nc.solusar.de; + + access_log /var/log/nginx/012-nextcloud-access.log; + error_log /var/log/nginx/012-nextcloud-error.log; + + #ssl on; + ssl_certificate /etc/letsencrypt/live/nc.solusar.de/fullchain.pem; + ssl_trusted_certificate /etc/letsencrypt/live/nc.solusar.de/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/nc.solusar.de/privkey.pem; + + ssl_dhparam /etc/myssl/dh4096.pem; + ssl_protocols TLSv1.2; + ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK'; + ssl_session_timeout 5m; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:50m; + + + # set max upload size + client_max_body_size 512M; + fastcgi_buffers 64 4K; + + # Enable gzip but do not remove ETag headers + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + + # Pagespeed is not supported by Nextcloud, so if your server is built + # with the `ngx_pagespeed` module, uncomment this line to disable it. + #pagespeed off; + + # HTTP response headers borrowed from Nextcloud `.htaccess` + add_header Referrer-Policy "no-referrer" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Download-Options "noopen" always; + add_header X-Frame-Options "sameorigin" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "none" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; + #add_header Content-Security-Policy "default-src 'none'; font-src 'self'; script-src 'self' 'unsafe-inline' https://nc.solusar.de; img-src * data:; object-src 'none'; style-src 'self' 'unsafe-inline' 'sha256-bQfd5MwpJ1ZxnVh373acxlqXQ8VwM88QhEHNuQ0ppNg='; frame-src 'self'; connect-src 'self'; form-action 'self'; base-uri 'self';frame-ancestors 'self';"; + + # Remove X-Powered-By, which is an information leak + fastcgi_hide_header X-Powered-By; + + # Path to the root of your installation + root /var/www/vhosts/solusar.de/subdomains/nextcloud; + + # Specify how to handle directories -- specifying `/index.php$request_uri` + # here as the fallback means that Nginx always exhibits the desired behaviour + # when a client requests a path that corresponds to a directory that exists + # on the server. In particular, if that directory contains an index.php file, + # that file is correctly served; if it doesn't, then the request is passed to + # the front-end controller. This consistent behaviour means that we don't need + # to specify custom rules for certain paths (e.g. images and other assets, + # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus + # `try_files $uri $uri/ /index.php$request_uri` + # always provides the desired behaviour. + index index.php index.html /index.php$request_uri; + + # Default Cache-Control policy + expires 1m; + + # Rule borrowed from `.htaccess` to handle Microsoft DAV clients + location = / { + if ( $http_user_agent ~ ^DavClnt ) { + return 302 /remote.php/webdav/$is_args$args; + } + } + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + # Make a regex exception for `/.well-known` so that clients can still + # access it despite the existence of the regex rule + # `location ~ /(\.|autotest|...)` which would otherwise handle requests + # for `/.well-known`. + location ^~ /.well-known { + # The following 6 rules are borrowed from `.htaccess` + + rewrite ^/\.well-known/host-meta\.json /public.php?service=host-meta-json last; + rewrite ^/\.well-known/host-meta /public.php?service=host-meta last; + rewrite ^/\.well-known/webfinger /public.php?service=webfinger last; + rewrite ^/\.well-known/nodeinfo /public.php?service=nodeinfo last; + + location = /.well-known/carddav { return 301 /remote.php/dav/; } + location = /.well-known/caldav { return 301 /remote.php/dav/; } + + try_files $uri $uri/ =404; + } + + # Rules borrowed from `.htaccess` to hide certain paths from clients + location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; } + location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; } + + # Ensure this block, which passes PHP files to the PHP process, is above the blocks + # which handle static assets (as seen below). If this block is not declared first, + # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php` + # to the URI, resulting in a HTTP 500 error response. + location ~ \.php(?:$|/) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + set $path_info $fastcgi_path_info; + + try_files $fastcgi_script_name =404; + + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; + fastcgi_param HTTPS on; + + fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice + fastcgi_param front_controller_active true; # Enable pretty urls + fastcgi_pass php-handler; + + fastcgi_intercept_errors on; + fastcgi_request_buffering off; + } + + location ~ \.(?:css|js|svg|gif)$ { + #try_files $uri /index.php$request_uri; + try_files $uri /index.php$uri$is_args$args; + expires 6M; # Cache-Control policy borrowed from `.htaccess` + access_log off; # Optional: Don't log access to assets + } + + location ~ \.woff2?$ { + try_files $uri /index.php$request_uri; + expires 7d; # Cache-Control policy borrowed from `.htaccess` + access_log off; # Optional: Don't log access to assets + } + + #location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ { + # try_files $uri /index.php$uri$is_args$args; + # access_log off; + #} + + location / { + try_files $uri $uri/ /index.php$request_uri; + } + + location ^~ /data { + deny all; + } +} diff --git a/013-projectsend b/013-projectsend new file mode 100644 index 0000000..f91ce57 --- /dev/null +++ b/013-projectsend @@ -0,0 +1,110 @@ +#upstream php-handler { +# #server 127.0.0.1:9000; +# server unix:/var/run/php/php7.4-fpm.sock; +#} + +server { + listen 80; + #listen [::]:80; + server_name ps.solusar.de; + + # Enforce HTTPS + return 301 https://$server_name$request_uri; +} + +server { + listen 443 ssl http2; + #listen [::]:443 ssl http2; + server_name ps.solusar.de; + + #ssl on; + ssl_certificate /etc/letsencrypt/live/nc.solusar.de/fullchain.pem; + ssl_trusted_certificate /etc/letsencrypt/live/nc.solusar.de/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/nc.solusar.de/privkey.pem; + + ssl_dhparam /etc/myssl/dh4096.pem; + ssl_protocols TLSv1.2; + ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK'; + ssl_session_timeout 5m; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:50m; + + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; + #add_header X-Frame-Options "SAMEORIGIN"; + #add_header X-Content-Type-Options nosniff; + #add_header X-XSS-Protection "1; mode=block"; + #add_header Content-Security-Policy "default-src 'none'; font-src 'self'; script-src 'self' 'unsafe-inline' https://nc.solusar.de; img-src * data:; object-src 'none'; style-src 'self' 'unsafe-inline' 'sha256-bQfd5MwpJ1ZxnVh373acxlqXQ8VwM88QhEHNuQ0ppNg='; frame-src 'self'; connect-src 'self'; form-action 'self'; base-uri 'self';frame-ancestors 'self';"; + + # set max upload size + client_max_body_size 2048M; + fastcgi_buffers 64 4K; + + # Enable gzip but do not remove ETag headers + #gzip on; + #gzip_vary on; + #gzip_comp_level 4; + #gzip_min_length 256; + #gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + #gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + + # Pagespeed is not supported by Nextcloud, so if your server is built + # with the `ngx_pagespeed` module, uncomment this line to disable it. + #pagespeed off; + + # HTTP response headers borrowed from Nextcloud `.htaccess` + add_header Referrer-Policy "no-referrer" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Download-Options "noopen" always; + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "none" always; + add_header X-XSS-Protection "1; mode=block" always; + + # Remove X-Powered-By, which is an information leak + fastcgi_hide_header X-Powered-By; + + # Path to the root of your installation + root /var/www/vhosts/solusar.de/subdomains/projectsend; + + # Specify how to handle directories -- specifying `/index.php$request_uri` + # here as the fallback means that Nginx always exhibits the desired behaviour + # when a client requests a path that corresponds to a directory that exists + # on the server. In particular, if that directory contains an index.php file, + # that file is correctly served; if it doesn't, then the request is passed to + # the front-end controller. This consistent behaviour means that we don't need + # to specify custom rules for certain paths (e.g. images and other assets, + # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus + # `try_files $uri $uri/ /index.php$request_uri` + # always provides the desired behaviour. + index index.php index.html /index.php$request_uri; + + # Default Cache-Control policy + expires 1m; + + # Ensure this block, which passes PHP files to the PHP process, is above the blocks + # which handle static assets (as seen below). If this block is not declared first, + # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php` + # to the URI, resulting in a HTTP 500 error response. + location ~ \.php(?:$|/) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + set $path_info $fastcgi_path_info; + + try_files $fastcgi_script_name =404; + + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; + fastcgi_param HTTPS on; + + fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice + fastcgi_param front_controller_active true; # Enable pretty urls + fastcgi_pass php-handler; + + fastcgi_intercept_errors on; + fastcgi_request_buffering off; + } + + #location / { + # try_files $uri $uri/ /index.php$request_uri; + #} +} diff --git a/013-projectsend.conf b/013-projectsend.conf new file mode 100644 index 0000000..f91ce57 --- /dev/null +++ b/013-projectsend.conf @@ -0,0 +1,110 @@ +#upstream php-handler { +# #server 127.0.0.1:9000; +# server unix:/var/run/php/php7.4-fpm.sock; +#} + +server { + listen 80; + #listen [::]:80; + server_name ps.solusar.de; + + # Enforce HTTPS + return 301 https://$server_name$request_uri; +} + +server { + listen 443 ssl http2; + #listen [::]:443 ssl http2; + server_name ps.solusar.de; + + #ssl on; + ssl_certificate /etc/letsencrypt/live/nc.solusar.de/fullchain.pem; + ssl_trusted_certificate /etc/letsencrypt/live/nc.solusar.de/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/nc.solusar.de/privkey.pem; + + ssl_dhparam /etc/myssl/dh4096.pem; + ssl_protocols TLSv1.2; + ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK'; + ssl_session_timeout 5m; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:50m; + + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; + #add_header X-Frame-Options "SAMEORIGIN"; + #add_header X-Content-Type-Options nosniff; + #add_header X-XSS-Protection "1; mode=block"; + #add_header Content-Security-Policy "default-src 'none'; font-src 'self'; script-src 'self' 'unsafe-inline' https://nc.solusar.de; img-src * data:; object-src 'none'; style-src 'self' 'unsafe-inline' 'sha256-bQfd5MwpJ1ZxnVh373acxlqXQ8VwM88QhEHNuQ0ppNg='; frame-src 'self'; connect-src 'self'; form-action 'self'; base-uri 'self';frame-ancestors 'self';"; + + # set max upload size + client_max_body_size 2048M; + fastcgi_buffers 64 4K; + + # Enable gzip but do not remove ETag headers + #gzip on; + #gzip_vary on; + #gzip_comp_level 4; + #gzip_min_length 256; + #gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + #gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + + # Pagespeed is not supported by Nextcloud, so if your server is built + # with the `ngx_pagespeed` module, uncomment this line to disable it. + #pagespeed off; + + # HTTP response headers borrowed from Nextcloud `.htaccess` + add_header Referrer-Policy "no-referrer" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Download-Options "noopen" always; + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "none" always; + add_header X-XSS-Protection "1; mode=block" always; + + # Remove X-Powered-By, which is an information leak + fastcgi_hide_header X-Powered-By; + + # Path to the root of your installation + root /var/www/vhosts/solusar.de/subdomains/projectsend; + + # Specify how to handle directories -- specifying `/index.php$request_uri` + # here as the fallback means that Nginx always exhibits the desired behaviour + # when a client requests a path that corresponds to a directory that exists + # on the server. In particular, if that directory contains an index.php file, + # that file is correctly served; if it doesn't, then the request is passed to + # the front-end controller. This consistent behaviour means that we don't need + # to specify custom rules for certain paths (e.g. images and other assets, + # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus + # `try_files $uri $uri/ /index.php$request_uri` + # always provides the desired behaviour. + index index.php index.html /index.php$request_uri; + + # Default Cache-Control policy + expires 1m; + + # Ensure this block, which passes PHP files to the PHP process, is above the blocks + # which handle static assets (as seen below). If this block is not declared first, + # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php` + # to the URI, resulting in a HTTP 500 error response. + location ~ \.php(?:$|/) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + set $path_info $fastcgi_path_info; + + try_files $fastcgi_script_name =404; + + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; + fastcgi_param HTTPS on; + + fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice + fastcgi_param front_controller_active true; # Enable pretty urls + fastcgi_pass php-handler; + + fastcgi_intercept_errors on; + fastcgi_request_buffering off; + } + + #location / { + # try_files $uri $uri/ /index.php$request_uri; + #} +}