Guest User

Untitled

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