Advertisement
Guest User

Untitled

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