Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.55 KB | None | 0 0
  1. upstream php-handler {
  2.   server 127.0.0.1:9000;
  3. # server unix:/var/run/php/php7.0-fpm.sock;
  4. }
  5.  
  6. server {
  7.   listen 80;
  8.   server_name _;
  9.   # enforce https
  10.  return 301 https://$server_name$request_uri;
  11. }
  12.  
  13. server {
  14.   listen 443 ssl;
  15.   server_name _;
  16.  
  17.   ssl_certificate /config/keys/cert.crt;
  18.   ssl_certificate_key /config/keys/cert.key;
  19.  
  20.   # Add headers to serve security related headers
  21.  add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
  22.   add_header X-Content-Type-Options nosniff;
  23.   add_header X-Frame-Options "SAMEORIGIN";
  24.   add_header X-XSS-Protection "1; mode=block";
  25.   add_header X-Robots-Tag none;
  26.   add_header X-Download-Options noopen;
  27.   add_header X-Permitted-Cross-Domain-Policies none;
  28.   add_header Referrer-Policy no-referrer always;
  29.  
  30.   # Path to the root of your installation
  31.  root /config/www/nextcloud/;
  32.   # set max upload size
  33.  client_max_body_size 10G;
  34.   fastcgi_buffers 64 4K;
  35.  
  36.   # Disable gzip to avoid the removal of the ETag header
  37.  gzip off;
  38.  
  39.   # Uncomment if your server is build with the ngx_pagespeed module
  40.  # This module is currently not supported.
  41.  #pagespeed off;
  42.  
  43. location / {
  44.         rewrite ^ /index.php$request_uri;
  45.     }
  46.  
  47.     location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
  48.         deny all;
  49.     }
  50.     location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
  51.         deny all;
  52.     }
  53.  
  54.     location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
  55.         fastcgi_split_path_info ^(.+?\.php)(/.*)$;
  56.         include /etc/nginx/fastcgi_params;
  57.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  58.         fastcgi_param PATH_INFO $fastcgi_path_info;
  59.         fastcgi_param HTTPS on;
  60.         #Avoid sending the security headers twice
  61.        fastcgi_param modHeadersAvailable true;
  62.         fastcgi_param front_controller_active true;
  63.         fastcgi_pass php-handler;
  64.         fastcgi_intercept_errors on;
  65.         fastcgi_request_buffering off;
  66.     }
  67.  
  68.     location ~ ^/(?:updater|ocs-provider)(?:$|/) {
  69.         try_files $uri/ =404;
  70.         index index.php;
  71.     }
  72.  
  73.     # Adding the cache control header for js and css files
  74.    # Make sure it is BELOW the PHP block
  75.    location ~ \.(?:css|js|woff|svg|gif)$ {
  76.         try_files $uri /index.php$request_uri;
  77.         add_header Cache-Control "public, max-age=15778463";
  78.         # Add headers to serve security related headers (It is intended to
  79.        # have those duplicated to the ones above)
  80.        # Before enabling Strict-Transport-Security headers please read into
  81.        # this topic first.
  82.        # add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
  83.        #
  84.        # WARNING: Only add the preload option once you read about
  85.        # the consequences in https://hstspreload.org/. This option
  86.        # will add the domain to a hardcoded list that is shipped
  87.        # in all major browsers and getting removed from this list
  88.        # could take several months.
  89.        add_header X-Content-Type-Options nosniff;
  90.         add_header X-XSS-Protection "1; mode=block";
  91.         add_header X-Robots-Tag none;
  92.         add_header X-Download-Options noopen;
  93.         add_header X-Permitted-Cross-Domain-Policies none;
  94.         # Optional: Don't log access to assets
  95.        access_log off;
  96.     }
  97.  
  98.     location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
  99.         try_files $uri /index.php$request_uri;
  100.         # Optional: Don't log access to other assets
  101.        access_log off;
  102.     }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement