Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
124
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. upstream php-handler {
  2.         server unix:/run/php/php7.2-fpm.sock;
  3. }
  4.  
  5. server {
  6.         listen 80;
  7.         listen [::]:80;
  8.         server_name cloud.domain;
  9.         return 301 https://$server_name$request_uri;
  10. }
  11.  
  12. server {
  13.         listen 443 ssl http2;
  14.         listen [::]:443 ssl http2;
  15.         server_name cloud.domain;
  16.  
  17.         ssl_certificate /etc/letsencrypt/live/cloud.domain/fullchain.pem;
  18.         ssl_certificate_key /etc/letsencrypt/live/cloud.domain/privkey.pem;
  19.         ssl_trusted_certificate /etc/letsencrypt/live/cloud.domain/chain.pem;
  20.         resolver 8.8.8.8;
  21.         ssl_session_timeout 1d;
  22.         ssl_session_cache shared:SSL:50m;
  23.         ssl_session_tickets off;
  24.         ssl_protocols TLSv1.2;
  25.         ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
  26.         ssl_prefer_server_ciphers on;
  27.         add_header Strict-Transport-Security max-age=15768000;
  28.         ssl_stapling on;
  29.         ssl_stapling_verify on;
  30.         add_header X-Content-Type-Options nosniff;
  31.         add_header X-XSS-Protection "1; mode=block";
  32.         add_header X-Robots-Tag none;
  33.         add_header X-Download-Options noopen;
  34.         add_header X-Permitted-Cross-Domain-Policies none;
  35.  
  36.         access_log /var/log/nginx/nextcloud-access.log combined;
  37.         error_log /var/log/nginx/nextcloud-error.log error;
  38.      
  39.         root /var/www/html/nextcloud/;
  40.  
  41.         location = /robots.txt {
  42.                 allow all;
  43.                 log_not_found off;
  44.                 access_log off;
  45.                 }
  46.  
  47.         location = /.well-known/carddav {
  48.                 return 301 $scheme://$host/remote.php/dav;
  49.                 }
  50.         location = /.well-known/caldav {
  51.                 return 301 $scheme://$host/remote.php/dav;
  52.                 }
  53.  
  54.         client_max_body_size 1G;
  55.         fastcgi_buffers 64 4K;
  56.  
  57.         gzip on;
  58.         gzip_vary on;
  59.         gzip_comp_level 4;
  60.         gzip_min_length 256;
  61.         gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  62.         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;
  63.  
  64.         location / {
  65.                 rewrite ^ /index.php$uri;
  66.                 }
  67.         location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
  68.                 deny all;
  69.                 }
  70.         location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
  71.                 deny all;
  72.         }
  73.  
  74.         location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
  75.                 fastcgi_split_path_info ^(.+\.php)(/.*)$;
  76.                 include fastcgi_params;
  77.                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  78.                 fastcgi_param PATH_INFO $fastcgi_path_info;
  79.                 fastcgi_param HTTPS on;
  80.                 #Avoid sending the security headers twice
  81.                 fastcgi_param modHeadersAvailable true;
  82.                 fastcgi_param front_controller_active true;
  83.                 fastcgi_pass php-handler;
  84.                 fastcgi_intercept_errors on;
  85.                 fastcgi_request_buffering off;
  86.                 }
  87.  
  88.         location ~ ^/(?:updater|ocs-provider)(?:$|/) {
  89.                 try_files $uri/ =404;
  90.                 index index.php;
  91.                 }
  92.  
  93.         location ~ \.(?:css|js|woff|svg|gif)$ {
  94.                 try_files $uri /index.php$uri$is_args$args;
  95.                 add_header Cache-Control "public, max-age=15778463";
  96.                 add_header Strict-Transport-Security max-age=15768000;
  97.                 add_header X-Content-Type-Options nosniff;
  98.                 add_header X-XSS-Protection "1; mode=block";
  99.                 add_header X-Robots-Tag none;
  100.                 add_header X-Download-Options noopen;
  101.                 add_header X-Permitted-Cross-Domain-Policies none;
  102.                 # Optional: Don't log access to assets
  103.                 access_log off;
  104.                 }
  105.  
  106.         location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
  107.                 try_files $uri /index.php$uri$is_args$args;
  108.                 # Optional: Don't log access to other assets
  109.                 access_log off;
  110.                 }
  111.  
  112. }
Advertisement
RAW Paste Data Copied
Advertisement