Advertisement
Guest User

Untitled

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