Advertisement
Guest User

Untitled

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