nextcloud_ngx.conf 2.9 KB

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