Advertisement
Guest User

Untitled

a guest
Feb 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1. upstream php-handler {
  2. #server 127.0.0.1:9000;
  3. server unix:/var/run/php/php7.0-fpm.sock;
  4. }
  5.  
  6. server {
  7. listen 80;
  8. server_name domain.example.cc;
  9. # enforce https
  10. return 301 https://$server_name$request_uri;
  11. }
  12.  
  13. server {
  14. listen 443 ssl http2;
  15. server_name domain.example.cc;
  16.  
  17. ssl_certificate /etc/nginx/ssl/cert.cc.crt;
  18. ssl_certificate_key /etc/nginx/ssl/key.cc.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. #
  26. # WARNING: Only add the preload option once you read about
  27. # the consequences in https://hstspreload.org/. This option
  28. # will add the domain to a hardcoded list that is shipped
  29. # in all major browsers and getting removed from this list
  30. # could take several months.
  31. add_header X-Content-Type-Options nosniff;
  32. add_header X-XSS-Protection "1; mode=block";
  33. add_header X-Robots-Tag none;
  34. add_header X-Download-Options noopen;
  35. add_header X-Permitted-Cross-Domain-Policies none;
  36.  
  37. proxy_buffering off;
  38.  
  39. # Path to the root of your installation
  40. root /var/www/html/nextcloud;
  41.  
  42. location = /robots.txt {
  43. allow all;
  44. log_not_found off;
  45. access_log off;
  46. }
  47.  
  48. # The following 2 rules are only needed for the user_webfinger app.
  49. # Uncomment it if you're planning to use this app.
  50. #rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
  51. #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json
  52. # last;
  53.  
  54. location = /.well-known/carddav {
  55. return 301 $scheme://$host/remote.php/dav;
  56. }
  57. location = /.well-known/caldav {
  58. return 301 $scheme://$host/remote.php/dav;
  59. }
  60.  
  61. # set max upload size
  62. client_max_body_size 50G;
  63. fastcgi_buffers 64 4K;
  64.  
  65. # Enable gzip but do not remove ETag headers
  66. gzip on;
  67. gzip_vary on;
  68. gzip_comp_level 4;
  69. gzip_min_length 256;
  70. gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  71. 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;
  72.  
  73. # Uncomment if your server is build with the ngx_pagespeed module
  74. # This module is currently not supported.
  75. #pagespeed off;
  76.  
  77. location / {
  78. rewrite ^ /index.php$uri;
  79. }
  80.  
  81. location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
  82. deny all;
  83. }
  84. location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
  85. deny all;
  86. }
  87.  
  88. location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
  89. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  90. include fastcgi_params;
  91. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  92. fastcgi_param PATH_INFO $fastcgi_path_info;
  93. fastcgi_param HTTPS on;
  94. #Avoid sending the security headers twice
  95. fastcgi_param modHeadersAvailable true;
  96. fastcgi_param front_controller_active true;
  97. fastcgi_pass php-handler;
  98. fastcgi_intercept_errors on;
  99. fastcgi_request_buffering off;
  100. }
  101.  
  102. location ~ ^/(?:updater|ocs-provider)(?:$|/) {
  103. try_files $uri/ =404;
  104. index index.php;
  105. }
  106.  
  107. # Adding the cache control header for js and css files
  108. # Make sure it is BELOW the PHP block
  109. location ~ \.(?:css|js|woff|svg|gif)$ {
  110. try_files $uri /index.php$uri$is_args$args;
  111. add_header Cache-Control "public, max-age=15778463";
  112. # Add headers to serve security related headers (It is intended to
  113. # have those duplicated to the ones above)
  114. # Before enabling Strict-Transport-Security headers please read into
  115. # this topic first.
  116. # add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
  117. #
  118. # WARNING: Only add the preload option once you read about
  119. # the consequences in https://hstspreload.org/. This option
  120. # will add the domain to a hardcoded list that is shipped
  121. # in all major browsers and getting removed from this list
  122. # could take several months.
  123. add_header X-Content-Type-Options nosniff;
  124. # add_header X-XSS-Protection "1; mode=block";
  125. add_header X-Robots-Tag none;
  126. add_header X-Download-Options noopen;
  127. add_header X-Permitted-Cross-Domain-Policies none;
  128.  
  129. # Optional: Don't log access to assets
  130. access_log off;
  131. }
  132.  
  133. location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
  134. try_files $uri /index.php$uri$is_args$args;
  135. # Optional: Don't log access to other assets
  136. access_log off;
  137. }
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement