seafilepro.conf 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ##
  2. # You should look at the following URL's in order to grasp a solid understanding
  3. # of Nginx configuration files in order to fully unleash the power of Nginx.
  4. # http://wiki.nginx.org/Pitfalls
  5. # http://wiki.nginx.org/QuickStart
  6. # http://wiki.nginx.org/Configuration
  7. #
  8. # Generally, you will want to move this file somewhere, and start with a clean
  9. # file but keep this around for reference. Or just disable in sites-enabled.
  10. #
  11. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
  12. ##
  13. # Default server configuration
  14. #
  15. map $sent_http_content_type $expires {
  16. default off;
  17. text/html epoch;
  18. text/css max;
  19. application/javascript max;
  20. ~image/ max;
  21. }
  22. upstream seafilepro {
  23. server seafilepro-service-dockerbunker:80;
  24. }
  25. server {
  26. listen 80;
  27. server_name ${SERVICE_DOMAIN};
  28. return 301 https://$host$request_uri;
  29. add_header X-Content-Type-Options "nosniff" always;
  30. add_header X-XSS-Protection "1; mode=block" always;
  31. add_header X-Frame-Options "DENY" always;
  32. add_header Referrer-Policy "strict-origin" always;
  33. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
  34. server_tokens off;
  35. }
  36. server {
  37. listen 443 ssl;
  38. server_name ${SERVICE_DOMAIN};
  39. ssl_certificate /etc/nginx/ssl/${SERVICE_DOMAIN}/cert.pem;
  40. ssl_certificate_key /etc/nginx/ssl/${SERVICE_DOMAIN}/key.pem;
  41. include /etc/nginx/includes/ssl.conf;
  42. add_header X-Content-Type-Options "nosniff" always;
  43. add_header X-XSS-Protection "1; mode=block" always;
  44. add_header X-Frame-Options "DENY" always;
  45. add_header Referrer-Policy "strict-origin" always;
  46. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
  47. include /etc/nginx/includes/gzip.conf;
  48. location / {
  49. proxy_pass http://seafilepro/;
  50. proxy_set_header Host $host;
  51. proxy_set_header X-Real-IP $remote_addr;
  52. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  53. proxy_set_header X-Forwarded-Host $server_name;
  54. proxy_set_header X-Forwarded-Proto https;
  55. proxy_request_buffering off;
  56. access_log /var/log/nginx/dav.access.log;
  57. error_log /var/log/nginx/dav.error.log;
  58. proxy_read_timeout 1200s;
  59. client_max_body_size 0;
  60. }
  61. expires $expires;
  62. # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
  63. location ~ /\. {
  64. deny all;
  65. access_log off;
  66. log_not_found off;
  67. }
  68. location ^~ /.well-known/ {
  69. access_log off;
  70. log_not_found off;
  71. root /var/www/html;
  72. # autoindex off;
  73. index index.html; # "no-such-file.txt",if expected protos don't need it
  74. try_files $uri $uri/ =404;
  75. }
  76. }