nextcloud_ngx.conf 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # this is a comments
  2. upstream my-api {
  3. server 127.0.0.1:9001;
  4. server 127.0.0.1:9002;
  5. }
  6. # this is a comments
  7. server {
  8. # this is a comments
  9. listen 8443 ssl http2;
  10. listen [::]:8443 ssl http2;
  11. server_name cloud.jackyu.cn;
  12. # this is a comments
  13. ssl_certificate /etc/nginx/ssl/jackyu.cn/alpha/jackyu.cn_server_cert.pem;
  14. ssl_certificate_key /etc/nginx/ssl/jackyu.cn/alpha/jackyu.cn_key.pem;
  15. fastcgi_hide_header X-Powered-By; # Remove X-Powered-By, which is an information leak
  16. if ($invalid_referer) {
  17. return 403;
  18. }
  19. location = /robots.txt {
  20. allow all;
  21. log_not_found off;
  22. access_log off;
  23. }
  24. # Make a regex exception for `/.well-known` so that clients can still
  25. # access it despite the existence of the regex rule
  26. # `location ~ /(\.|autotest|...)` which would otherwise handle requests
  27. # for `/.well-known`.
  28. location = /.well-known/carddav { return 301 /remote.php/dav/; }
  29. location ^~ /.well-known
  30. {
  31. # The rules in this block are an adaptation of the rules
  32. # in `.htaccess` that concern `/.well-known`.
  33. location = /.well-known/carddav { return 301 /remote.php/dav/; }
  34. location = /.well-known/caldav { return 301 /remote.php/dav/; }
  35. location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
  36. location /.well-known/pki-validation {
  37. try_files $uri $uri/ =404;
  38. }
  39. # Let Nextcloud's API for `/.well-known` URIs handle all other
  40. # requests by passing them to the front-end controller.
  41. return 301 /index.php$request_uri;
  42. }
  43. # set max upload size
  44. client_max_body_size 8192M;
  45. fastcgi_buffers 64 4K;
  46. # Enable gzip but do not remove ETag headers
  47. gzip on; gzip_vary on; location /x/ {}gzip_comp_level 4;
  48. gzip_min_length 256;gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  49. 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;
  50. # Uncomment if your server is build with the ngx_pagespeed module
  51. # This module is currently not supported.
  52. # pagespeed off;
  53. location / {
  54. if ( $http_user_agent ~ ^DavClnt ) {
  55. return 302 /remote.php/webdav/$is_args$args;
  56. }
  57. proxy_set_header Host $host;
  58. proxy_set_header X-Real-IP $remote_addr;
  59. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  60. proxy_set_header X-Forwarded-Proto $scheme;
  61. proxy_http_version 1.1;
  62. proxy_intercept_errors on;
  63. proxy_pass http://172.17.0.1:7000;
  64. }
  65. }