Advertisement
Guest User

Untitled

a guest
Apr 10th, 2018
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 KB | None | 0 0
  1. server {
  2. listen 80;
  3. server_name nextcloud.your-domain.com;
  4. return 301 https://$server_name$request_uri;
  5. }
  6.  
  7. server {
  8. listen 443 ssl http2;
  9. server_name nextcloud.your-domain.com;
  10.  
  11. ssl_certificate /etc/letsencrypt/live/nextcloud.your-domain.com/fullchain.pem;
  12. ssl_certificate_key /etc/letsencrypt/live/nextcloud.your-domain.com/privkey.pem;
  13.  
  14. ssl_session_timeout 1d;
  15. ssl_session_cache shared:SSL:10m;
  16. ssl_session_tickets off;
  17. ssl_protocols TLSv1.1 TLSv1.2;
  18. ssl_prefer_server_ciphers on;
  19.  
  20. 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';
  21.  
  22. # Add headers to serve security related headers
  23. # Before enabling Strict-Transport-Security headers please read into this
  24. # topic first.
  25. add_header Strict-Transport-Security "max-age=15768000;preload" always;
  26. add_header X-Content-Type-Options nosniff;
  27. add_header X-Frame-Options "SAMEORIGIN";
  28. add_header X-XSS-Protection "1; mode=block";
  29. add_header X-Robots-Tag none;
  30. add_header X-Download-Options noopen;
  31. add_header X-Permitted-Cross-Domain-Policies none;
  32.  
  33. # Path to the root of your installation
  34. root /usr/share/nginx/nextcloud/;
  35.  
  36. location = /robots.txt {
  37. allow all;
  38. log_not_found off;
  39. access_log off;
  40. }
  41.  
  42. # The following 2 rules are only needed for the user_webfinger app.
  43. # Uncomment it if you're planning to use this app.
  44. #rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
  45. #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json
  46. # last;
  47.  
  48. location = /.well-known/carddav {
  49. return 301 $scheme://$host/remote.php/dav;
  50. }
  51. location = /.well-known/caldav {
  52. return 301 $scheme://$host/remote.php/dav;
  53. }
  54.  
  55. location ~ /.well-known/acme-challenge {
  56. allow all;
  57. }
  58.  
  59. # set max upload size
  60. client_max_body_size 512M;
  61. fastcgi_buffers 64 4K;
  62.  
  63. # Disable gzip to avoid the removal of the ETag header
  64. gzip off;
  65.  
  66. # Uncomment if your server is build with the ngx_pagespeed module
  67. # This module is currently not supported.
  68. #pagespeed off;
  69.  
  70. error_page 403 /core/templates/403.php;
  71. error_page 404 /core/templates/404.php;
  72.  
  73. location / {
  74. rewrite ^ /index.php$uri;
  75. }
  76.  
  77. location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
  78. deny all;
  79. }
  80. location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
  81. deny all;
  82. }
  83.  
  84. location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
  85. include fastcgi_params;
  86. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  87. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  88. fastcgi_param PATH_INFO $fastcgi_path_info;
  89. #Avoid sending the security headers twice
  90. fastcgi_param modHeadersAvailable true;
  91. fastcgi_param front_controller_active true;
  92. fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  93. fastcgi_intercept_errors on;
  94. fastcgi_request_buffering off;
  95. }
  96.  
  97. location ~ ^/(?:updater|ocs-provider)(?:$|/) {
  98. try_files $uri/ =404;
  99. index index.php;
  100. }
  101.  
  102. # Adding the cache control header for js and css files
  103. # Make sure it is BELOW the PHP block
  104. location ~* \.(?:css|js)$ {
  105. try_files $uri /index.php$uri$is_args$args;
  106. add_header Cache-Control "public, max-age=7200";
  107. # Add headers to serve security related headers (It is intended to
  108. # have those duplicated to the ones above)
  109. # Before enabling Strict-Transport-Security headers please read into
  110. # this topic first.
  111. add_header Strict-Transport-Security "max-age=15768000;preload" always;
  112. add_header X-Content-Type-Options nosniff;
  113. add_header X-Frame-Options "SAMEORIGIN";
  114. add_header X-XSS-Protection "1; mode=block";
  115. add_header X-Robots-Tag none;
  116. add_header X-Download-Options noopen;
  117. add_header X-Permitted-Cross-Domain-Policies none;
  118. # Optional: Don't log access to assets
  119. access_log off;
  120. }
  121.  
  122. location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
  123. try_files $uri /index.php$uri$is_args$args;
  124. # Optional: Don't log access to other assets
  125. access_log off;
  126. }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement