Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
3.4KB

  1. # default nginx site config for Pleroma
  2. #
  3. # Simple installation instructions:
  4. # 1. Install your TLS certificate, possibly using Let's Encrypt.
  5. # 2. Replace 'example.tld' with your instance's domain wherever it appears.
  6. # 3. Copy this file to /etc/nginx/sites-available/ and then add a symlink to it
  7. # in /etc/nginx/sites-enabled/ and run 'nginx -s reload' or restart nginx.
  8. proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=10g
  9. inactive=720m use_temp_path=off;
  10. server {
  11. server_name example.tld;
  12. listen 80;
  13. return 301 https://$server_name$request_uri;
  14. # Uncomment this if you need to use the 'webroot' method with certbot. Make sure
  15. # that you also create the .well-known/acme-challenge directory structure in pleroma/priv/static and
  16. # that is is accessible by the webserver. You may need to load this file with the ssl
  17. # server block commented out, run certbot to get the certificate, and then uncomment it.
  18. #
  19. # location ~ /\.well-known/acme-challenge {
  20. # root <path to install>/pleroma/priv/static/;
  21. # }
  22. }
  23. # Enable SSL session caching for improved performance
  24. ssl_session_cache shared:ssl_session_cache:10m;
  25. server {
  26. listen 443 ssl http2;
  27. ssl_session_timeout 5m;
  28. ssl_trusted_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
  29. ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
  30. ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
  31. # Add TLSv1.0 to support older devices
  32. ssl_protocols TLSv1.2;
  33. # Uncomment line below if you want to support older devices (Before Android 4.4.2, IE 8, etc.)
  34. # ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
  35. ssl_ciphers "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
  36. ssl_prefer_server_ciphers on;
  37. # In case of an old server with an OpenSSL version of 1.0.2 or below,
  38. # leave only prime256v1 or comment out the following line.
  39. ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
  40. ssl_stapling on;
  41. ssl_stapling_verify on;
  42. server_name example.tld;
  43. gzip_vary on;
  44. gzip_proxied any;
  45. gzip_comp_level 6;
  46. gzip_buffers 16 8k;
  47. gzip_http_version 1.1;
  48. gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;
  49. # the nginx default is 1m, not enough for large media uploads
  50. client_max_body_size 16m;
  51. location / {
  52. proxy_http_version 1.1;
  53. proxy_set_header Upgrade $http_upgrade;
  54. proxy_set_header Connection "upgrade";
  55. proxy_set_header Host $http_host;
  56. proxy_pass http://localhost:4000;
  57. client_max_body_size 16m;
  58. }
  59. location ~ ^/(media|proxy) {
  60. proxy_cache pleroma_media_cache;
  61. slice 1m;
  62. proxy_cache_key $host$uri$is_args$args$slice_range;
  63. proxy_set_header Range $slice_range;
  64. proxy_http_version 1.1;
  65. proxy_cache_valid 200 206 301 304 1h;
  66. proxy_cache_lock on;
  67. proxy_ignore_client_abort on;
  68. proxy_buffering off;
  69. chunked_transfer_encoding on;
  70. proxy_pass http://localhost:4000;
  71. }
  72. }