seafilepro.conf 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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;
  38. server_name ${SERVICE_DOMAIN};
  39. ssl on;
  40. ssl_certificate /etc/nginx/ssl/${SERVICE_DOMAIN}/cert.pem;
  41. ssl_certificate_key /etc/nginx/ssl/${SERVICE_DOMAIN}/key.pem;
  42. include /etc/nginx/includes/ssl.conf;
  43. add_header X-Content-Type-Options "nosniff" always;
  44. add_header X-XSS-Protection "1; mode=block" always;
  45. add_header X-Frame-Options "DENY" always;
  46. add_header Referrer-Policy "strict-origin" always;
  47. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
  48. include /etc/nginx/includes/gzip.conf;
  49. location / {
  50. proxy_pass http://seafilepro/;
  51. proxy_set_header Host $host;
  52. proxy_set_header X-Real-IP $remote_addr;
  53. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  54. proxy_set_header X-Forwarded-Host $server_name;
  55. proxy_set_header X-Forwarded-Proto https;
  56. proxy_request_buffering off;
  57. access_log /var/log/nginx/dav.access.log;
  58. error_log /var/log/nginx/dav.error.log;
  59. proxy_read_timeout 1200s;
  60. client_max_body_size 0;
  61. }
  62. expires $expires;
  63. # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
  64. location ~ /\. {
  65. deny all;
  66. access_log off;
  67. log_not_found off;
  68. }
  69. location ^~ /.well-known/ {
  70. access_log off;
  71. log_not_found off;
  72. root /var/www/html;
  73. # autoindex off;
  74. index index.html; # "no-such-file.txt",if expected protos don't need it
  75. try_files $uri $uri/ =404;
  76. }
  77. }