Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
99
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_header X-Content-Type-Options nosniff;
  2. add_header X-Frame-Options "SAMEORIGIN";
  3. add_header X-XSS-Protection "1; mode=block";
  4. add_header X-Robots-Tag none;
  5. add_header X-Download-Options noopen;
  6. add_header X-Permitted-Cross-Domain-Policies none;
  7. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
  8.    
  9. location = /robots.txt {
  10.     allow all;
  11.     log_not_found off;
  12.     access_log off;
  13. }
  14.  
  15. location = /.well-known/carddav {
  16.     return 301 $scheme://$host/remote.php/dav;
  17. }
  18.  
  19. location = /.well-known/caldav {
  20.     return 301 $scheme://$host/remote.php/dav;
  21. }
  22.  
  23. # Disable gzip to avoid the removal of the ETag header
  24. gzip off;
  25.  
  26. error_page 403 /core/templates/403.php;
  27. error_page 404 /core/templates/404.php;
  28.  
  29. location / {
  30.     rewrite ^ /index.php$uri;
  31. }
  32.  
  33. location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
  34.     deny all;
  35. }
  36.  
  37. location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
  38.         deny all;
  39.     }
  40.  
  41. location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
  42.     fastcgi_split_path_info ^(.+?\.php)(/.*)$;
  43.     if (!-f $document_root$fastcgi_script_name) {
  44.         return 404;
  45.     }
  46.     # Mitigate https://httpoxy.org/ vulnerabilities
  47.     fastcgi_param HTTP_PROXY "";
  48. include fastcgi_params;
  49.           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  50.         fastcgi_param PATH_INFO $fastcgi_path_info;
  51.  
  52.         #fastcgi_param HTTPS on;
  53.         #Avoid sending the security headers twice
  54.         fastcgi_param modHeadersAvailable true;
  55.         fastcgi_param front_controller_active true;
  56.         fastcgi_pass $socket;
  57.         fastcgi_intercept_errors on;
  58.  
  59.        # fastcgi_request_buffering off;
  60.  
  61.     }
  62.  
  63.     location ~ ^/(?:updater|ocs-provider)(?:$|/) {
  64.         try_files $uri/ =404;
  65.         index index.php;
  66.     }
  67.  
  68.     # Adding the cache control header for js and css files
  69.     # Make sure it is BELOW the PHP block
  70.     location ~* \.(?:css|js)$ {
  71.         try_files $uri /index.php$uri$is_args$args;
  72.         add_header Cache-Control "public, max-age=7200";
  73.         # Add headers to serve security related headers (It is intended to
  74.         # have those duplicated to the ones above)
  75.         # Before enabling Strict-Transport-Security headers please read into
  76.         # this topic first.
  77.         # add_header Strict-Transport-Security "max-age=15768000;
  78.         #  includeSubDomains; preload;";
  79.         add_header X-Content-Type-Options nosniff;
  80.         add_header X-Frame-Options "SAMEORIGIN";
  81.         add_header X-XSS-Protection "1; mode=block";
  82.         add_header X-Robots-Tag none;
  83.         add_header X-Download-Options noopen;
  84.         add_header X-Permitted-Cross-Domain-Policies none;
  85.         # Optional: Don't log access to assets
  86.         access_log off;
  87.     }
  88.  
  89.     location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
  90.         try_files $uri /index.php$uri$is_args$args;
  91.         # Optional: Don't log access to other assets
  92.         access_log off;
  93.     }
Advertisement
RAW Paste Data Copied
Advertisement