Advertisement
Guest User

Untitled

a guest
Aug 29th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 3.48 KB | None | 0 0
  1. server {
  2.     listen 80;
  3.     server_name nextcloud.dracula.host;
  4.  
  5.     # Add headers to serve security related headers
  6.     add_header X-Content-Type-Options nosniff;
  7.     add_header X-XSS-Protection "1; mode=block";
  8.     add_header X-Robots-Tag none;
  9.     add_header X-Download-Options noopen;
  10.     add_header X-Permitted-Cross-Domain-Policies none;
  11.  
  12.     #This header is already set in PHP, so it is commented out here.
  13.     #add_header X-Frame-Options "SAMEORIGIN";
  14.  
  15.     # Path to the root of your installation
  16.     root /var/www/html/nextcloud/;
  17.  
  18.     location = /robots.txt {
  19.         allow all;
  20.         log_not_found off;
  21.         access_log off;
  22.     }
  23.  
  24.     # The following 2 rules are only needed for the user_webfinger app.
  25.     # Uncomment it if you're planning to use this app.
  26.     #rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
  27.     #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json
  28.     # last;
  29.  
  30.     location = /.well-known/carddav {
  31.         return 301 $scheme://$host/remote.php/dav;
  32.     }
  33.     location = /.well-known/caldav {
  34.        return 301 $scheme://$host/remote.php/dav;
  35.     }
  36.  
  37.     location ~ /.well-known/acme-challenge {
  38.       allow all;
  39.     }
  40.  
  41.     # set max upload size
  42.     client_max_body_size 512M;
  43.     fastcgi_buffers 64 4K;
  44.  
  45.     # Disable gzip to avoid the removal of the ETag header
  46.     gzip off;
  47.  
  48.     # Uncomment if your server is build with the ngx_pagespeed module
  49.     # This module is currently not supported.
  50.     #pagespeed off;
  51.  
  52.     error_page 403 /core/templates/403.php;
  53.     error_page 404 /core/templates/404.php;
  54.  
  55.     location / {
  56.        rewrite ^ /index.php$uri;
  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/.+|core/templates/40[34])\.php(?:$|/) {
  67.        include fastcgi_params;
  68.        fastcgi_split_path_info ^(.+\.php)(/.*)$;
  69.        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  70.        fastcgi_param PATH_INFO $fastcgi_path_info;
  71.        #Avoid sending the security headers twice
  72.        fastcgi_param modHeadersAvailable true;
  73.        fastcgi_param front_controller_active true;
  74.        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
  75.        fastcgi_intercept_errors on;
  76.        fastcgi_request_buffering off;
  77.     }
  78.  
  79.     location ~ ^/(?:updater|ocs-provider)(?:$|/) {
  80.        try_files $uri/ =404;
  81.        index index.php;
  82.     }
  83.  
  84.     # Adding the cache control header for js and css files
  85.     # Make sure it is BELOW the PHP block
  86.     location ~* \.(?:css|js)$ {
  87.         try_files $uri /index.php$uri$is_args$args;
  88.         add_header Cache-Control "public, max-age=7200";
  89.         # Add headers to serve security related headers (It is intended to
  90.         # have those duplicated to the ones above)
  91.         add_header X-Content-Type-Options nosniff;
  92.         add_header X-XSS-Protection "1; mode=block";
  93.         add_header X-Robots-Tag none;
  94.         add_header X-Download-Options noopen;
  95.         add_header X-Permitted-Cross-Domain-Policies none;
  96.         # Optional: Don't log access to assets
  97.         access_log off;
  98.    }
  99.  
  100.    location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
  101.         try_files $uri /index.php$uri$is_args$args;
  102.         # Optional: Don't log access to other assets
  103.         access_log off;
  104.    }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement