Guest User

Untitled

a guest
Jun 9th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 4.40 KB | None | 0 0
  1. server {
  2.     listen 443 ssl http2;
  3.     listen [::]:443 ssl http2;
  4.     ssl_certificate [redacted]; # managed by Certbot
  5.     ssl_certificate_key [redacted]; # managed by Certbot
  6.     server_name cloud.iacchi.casa;
  7.     set $root_path "[redacted]";
  8.     root $root_path;
  9.     index index.php;
  10.     set $socket "unix:/var/run/fpm-cloud.iacchi.casa.sock";
  11.     location ~ \.php$ {
  12.         include snippets/fastcgi-php.conf;
  13.         fastcgi_pass $socket;
  14.     }
  15.     access_log [redacted];
  16.     error_log  [redacted];
  17.     large_client_header_buffers 4 8k;
  18.     add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
  19.     add_header X-Content-Type-Options nosniff;
  20.     add_header X-XSS-Protection "1; mode=block";
  21.     add_header X-Robots-Tag none;
  22.     add_header X-Download-Options noopen;
  23.     add_header X-Permitted-Cross-Domain-Policies none;
  24.     add_header Referrer-Policy no-referrer;
  25.  
  26.     # Remove X-Powered-By, which is an information leak
  27.     fastcgi_hide_header X-Powered-By;
  28.  
  29.     location = /robots.txt {
  30.         add_header  Content-Type  text/plain;
  31.         return 200 "User-agent: *\nDisallow: /\n";
  32.     }
  33.  
  34.     location = /.well-known/carddav {
  35.         return 301 $scheme://$host/remote.php/dav;
  36.     }
  37.     location = /.well-known/caldav {
  38.         return 301 $scheme://$host/remote.php/dav;
  39.     }
  40.  
  41.     location ~ /\.well-known/acme-challenge {
  42.         allow all;
  43.     }
  44.  
  45.     client_max_body_size 3072M;
  46.     fastcgi_buffers 64 4K;
  47.  
  48.     gzip on;
  49.     gzip_vary on;
  50.     gzip_comp_level 4;
  51.     gzip_min_length 256;
  52.     gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  53.     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;
  54.  
  55.     location / {
  56.         rewrite ^ /index.php;
  57.     }
  58.  
  59.     location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
  60.         deny all;
  61.     }
  62.     location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
  63.         deny all;
  64.     }
  65.  
  66.     location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+)\.php(?:$|\/) {
  67.         fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
  68.         try_files $fastcgi_script_name =404;
  69.         include fastcgi_params;
  70.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  71.         fastcgi_param PATH_INFO $fastcgi_path_info;
  72.         fastcgi_param HTTPS on;
  73.         #Avoid sending the security headers twice
  74.         fastcgi_param modHeadersAvailable true;
  75.         fastcgi_param front_controller_active true;
  76.         fastcgi_pass $socket;
  77.         fastcgi_intercept_errors on;
  78.         fastcgi_request_buffering off;
  79.     }
  80.  
  81.     location ~ ^\/(?:updater|ocs-provider)(?:$|\/) {
  82.         try_files $uri/ =404;
  83.         index index.php;
  84.     }
  85.  
  86.     # Adding the cache control header for js and css files
  87.     # Make sure it is BELOW the PHP block
  88.     location ~ \.(?:css|js|woff2?|svg|gif)$ {
  89.         try_files $uri /index.php$request_uri;
  90.         add_header Cache-Control "public, max-age=15778463";
  91.         # Add headers to serve security related headers (It is intended to have those duplicated to the ones above)
  92.         add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
  93.         add_header X-Content-Type-Options nosniff;
  94.         add_header X-XSS-Protection "1; mode=block";
  95.         add_header X-Robots-Tag none;
  96.         add_header X-Download-Options noopen;
  97.         add_header X-Permitted-Cross-Domain-Policies none;
  98.         add_header Referrer-Policy no-referrer;
  99.  
  100.         # Optional: Don't log access to assets
  101.         access_log off;
  102.     }
  103.  
  104.     location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
  105.         try_files $uri /index.php$request_uri;
  106.         # Optional: Don't log access to other assets
  107.         access_log off;
  108.     }
  109.  
  110. }
  111. server {
  112.     if ($host = cloud.iacchi.casa) {
  113.         return 301 https://$host$request_uri;
  114.     } # managed by Certbot
  115.  
  116.  
  117.     listen 80;
  118.     listen [::]:80;
  119.     server_name cloud.iacchi.casa;
  120.     return 404; # managed by Certbot
  121.  
  122.  
  123. }
Add Comment
Please, Sign In to add comment