logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

pleroma.nginx (8502B)


  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. # Note: The cache directory must exist and be writable by nginx.
  9. # If nginx runs in a chroot, create it inside the chroot.
  10. proxy_cache_path /var/tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=10g
  11. inactive=720m use_temp_path=off;
  12. # this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only
  13. # and `localhost.` resolves to [::0] on some systems: see issue #930
  14. upstream phoenix {
  15. server 127.0.0.1:4000 max_fails=5 fail_timeout=60s;
  16. }
  17. server {
  18. server_name example.tld;
  19. listen 80;
  20. listen [::]:80;
  21. # Uncomment this if you need to use the 'webroot' method with certbot. Make sure
  22. # that the directory exists and that it is accessible by the webserver. If you followed
  23. # the guide, you already ran 'mkdir -p /var/lib/letsencrypt' to create the folder.
  24. # You may need to load this file with the ssl server block commented out, run certbot
  25. # to get the certificate, and then uncomment it.
  26. #
  27. # location ~ /\.well-known/acme-challenge {
  28. # root /var/lib/letsencrypt/;
  29. # }
  30. location / {
  31. return 301 https://$server_name$request_uri;
  32. }
  33. }
  34. # Enable SSL session caching for improved performance
  35. ssl_session_cache shared:ssl_session_cache:10m;
  36. server {
  37. server_name example.tld;
  38. listen 443 ssl;
  39. listen [::]:443 ssl;
  40. http2 on;
  41. # Optional HTTP/3 support
  42. # Note: requires you open UDP port 443
  43. #
  44. # listen 443 quic reuseport;
  45. # listen [::]:443 quic reuseport;
  46. # http3 on;
  47. # quic_retry on;
  48. # ssl_early_data on;
  49. # quic_gso on;
  50. # add_header Alt-Svc 'h3=":443"; ma=86400';
  51. ssl_session_timeout 1d;
  52. ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
  53. ssl_session_tickets off;
  54. ssl_trusted_certificate /etc/letsencrypt/live/example.tld/chain.pem;
  55. ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
  56. ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
  57. ssl_protocols TLSv1.2 TLSv1.3;
  58. 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";
  59. ssl_prefer_server_ciphers off;
  60. # In case of an old server with an OpenSSL version of 1.0.2 or below,
  61. # leave only prime256v1 or comment out the following line.
  62. ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
  63. ssl_stapling on;
  64. ssl_stapling_verify on;
  65. gzip_vary on;
  66. gzip_proxied any;
  67. gzip_comp_level 6;
  68. gzip_buffers 16 8k;
  69. gzip_http_version 1.1;
  70. 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;
  71. # Nginx media upload limitation
  72. # Ensure that this value matches or exceeds your Pleroma upload limit:
  73. #
  74. # config :pleroma, :instance,
  75. # upload_limit: 16_000_000
  76. #
  77. client_max_body_size 16m;
  78. ignore_invalid_headers off;
  79. proxy_http_version 1.1;
  80. proxy_set_header Upgrade $http_upgrade;
  81. proxy_set_header Connection "upgrade";
  82. proxy_set_header Host $http_host;
  83. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  84. location / {
  85. proxy_pass http://phoenix;
  86. }
  87. # Uncomment this if you want notice compatibility routes for frontends like Soapbox.
  88. # location ~ ^/@[^/]+/([^/]+)$ {
  89. # proxy_pass http://phoenix/notice/$1;
  90. # }
  91. #
  92. # location ~ ^/@[^/]+/posts/([^/]+)$ {
  93. # proxy_pass http://phoenix/notice/$1;
  94. # }
  95. #
  96. # location ~ ^/[^/]+/status/([^/]+)$ {
  97. # proxy_pass http://phoenix/notice/$1;
  98. # }
  99. # Remove this location if you choose to use a dedicated subdomain
  100. # for mediaproxy
  101. location /proxy {
  102. proxy_cache pleroma_media_cache;
  103. slice 1m;
  104. proxy_cache_key $host$uri$is_args$args$slice_range;
  105. proxy_set_header Range $slice_range;
  106. proxy_cache_valid 200 206 301 304 1h;
  107. proxy_cache_lock on;
  108. proxy_ignore_client_abort on;
  109. proxy_buffering on;
  110. chunked_transfer_encoding on;
  111. proxy_pass http://phoenix;
  112. }
  113. # Nginx can serve the local file uploads directly reducing work for
  114. # the backend. Make sure to change this to a "deny all" if you use
  115. # a dedicated subdomain. It will break access to uploads that have already
  116. # federated if you are converting an existing installation, so weigh the risks
  117. # carefully.
  118. #
  119. # location /media/ {
  120. # alias /var/lib/pleroma/uploads/; # <-- make sure this is correct for your deployment
  121. # allow all;
  122. # add_header X-Content-Type-Options "nosniff";
  123. # add_header Content-Security-Policy "sandbox";
  124. # }
  125. }
  126. # It is strongly recommended that you host your media and the mediaproxy on a dedicated subdomain for security reasons.
  127. # The following Pleroma settings will be required to enable this capability:
  128. #
  129. # config :pleroma, :media_proxy,
  130. # base_url: "https://media.example.tld/"
  131. #
  132. # # Assuming default media upload deployment (e.g., not S3 which will require a different domain anyway) --
  133. # config :pleroma, Pleroma.Upload,
  134. # base_url: "https://media.example.tld/media/",
  135. #
  136. # config :pleroma, Pleroma.Uploaders.Local, uploads: "/var/lib/pleroma/uploads"
  137. #
  138. # And then uncomment and configure the following server.
  139. # Make sure your certificate was issued to support both domains or use a dedicated certificate:
  140. #
  141. # server {
  142. # server_name media.example.tld;
  143. #
  144. # listen 443 ssl;
  145. # listen [::]:443 ssl;
  146. # http2 on;
  147. #
  148. # # Optional HTTP/3 support
  149. # # Note: requires you open UDP port 443
  150. # #
  151. # # listen 443 quic reuseport;
  152. # # listen [::]:443 quic reuseport;
  153. # # http3 on;
  154. # # quic_retry on;
  155. # # ssl_early_data on;
  156. # # quic_gso on;
  157. # # add_header Alt-Svc 'h3=":443"; ma=86400';
  158. #
  159. # ssl_session_timeout 1d;
  160. # ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
  161. # ssl_session_tickets off;
  162. #
  163. # ssl_trusted_certificate /etc/letsencrypt/live/example.tld/chain.pem;
  164. # ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
  165. # ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
  166. #
  167. # ssl_protocols TLSv1.2 TLSv1.3;
  168. # 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";
  169. # ssl_prefer_server_ciphers off;
  170. # # In case of an old server with an OpenSSL version of 1.0.2 or below,
  171. # # leave only prime256v1 or comment out the following line.
  172. # ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
  173. # ssl_stapling on;
  174. # ssl_stapling_verify on;
  175. #
  176. # proxy_http_version 1.1;
  177. # proxy_set_header Upgrade $http_upgrade;
  178. # proxy_set_header Connection "upgrade";
  179. # proxy_set_header Host $http_host;
  180. # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  181. #
  182. # location /media/ { # <-- make sure this path matches your Pleroma.Upload :base_url
  183. # alias /var/lib/pleroma/uploads/; # <-- make sure this is correct for your deployment
  184. # allow all;
  185. # add_header X-Content-Type-Options "nosniff";
  186. # add_header Content-Security-Policy "sandbox";
  187. # }
  188. #
  189. # location /proxy {
  190. # proxy_cache pleroma_media_cache;
  191. # slice 1m;
  192. # proxy_cache_key $host$uri$is_args$args$slice_range;
  193. # proxy_set_header Range $slice_range;
  194. # proxy_cache_valid 200 206 301 304 1h;
  195. # proxy_cache_lock on;
  196. # proxy_ignore_client_abort on;
  197. # proxy_buffering on;
  198. # chunked_transfer_encoding on;
  199. # proxy_pass http://phoenix;
  200. # }
  201. # }