Advertisement
Guest User

Untitled

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