Guest User

Untitled

a guest
Oct 18th, 2023
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. #worker_processes auto;
  2. #removed because this should only be in /etc/nginx/nginx.conf
  3.  
  4.  
  5. #events {
  6. # worker_connections 1024;
  7. #}
  8. #removed because this should only be in /etc/nginx/nginx.conf
  9.  
  10. #http {
  11. #unwrapping because this whole file is included from the http{...} in /etc/nginx/nginx.conf
  12.  
  13. # We construct a string consistent of the "request method" and "http accept header"
  14. # and then apply soem ~simply regexp matches to that combination to decide on the
  15. # HTTP upstream we should proxy the request to.
  16. #
  17. # Example strings:
  18. #
  19. # "GET:application/activity+json"
  20. # "GET:text/html"
  21. # "POST:application/activity+json"
  22. #
  23. # You can see some basic match tests in this regex101 matching this configuration
  24. # https://regex101.com/r/vwMJNc/1
  25. #
  26. # Learn more about nginx maps here http://nginx.org/en/docs/http/ngx_http_map_module.html
  27. map "$request_method:$http_accept" $proxpass {
  28. # If no explicit matches exists below, send traffic to lemmy-ui
  29. default "http://lemmy-ui:1234";
  30.  
  31. # GET/HEAD requests that accepts ActivityPub or Linked Data JSON should go to lemmy.
  32. #
  33. # These requests are used by Mastodon and other fediverse instances to look up profile information,
  34. # discover site information and so on.
  35. "~^(?:GET|HEAD):.*?application\/(?:activity|ld)\+json" "http://lemmy:8536";
  36.  
  37. # All non-GET/HEAD requests should go to lemmy
  38. #
  39. # Rather than calling out POST, PUT, DELETE, PATCH, CONNECT and all the verbs manually
  40. # we simply negate the GET|HEAD pattern from above and accept all possibly $http_accept values
  41. "~^(?!(GET|HEAD)).*:" "http://lemmy:8536";
  42. }
  43.  
  44. server {
  45. # this is the port inside docker, not the public one yet
  46. listen 1236;
  47. listen 8536;
  48.  
  49. # change if needed, this is facing the public web
  50. server_name localhost;
  51. server_tokens off;
  52.  
  53. # Upload limit, relevant for pictrs
  54. client_max_body_size 20M;
  55.  
  56. # Send actual client IP upstream
  57. include proxy_params;
  58.  
  59. # frontend general requests
  60. location / {
  61. proxy_pass $proxpass;
  62. rewrite ^(.+)/+$ $1 permanent;
  63. }
  64.  
  65. # security.txt
  66. location = /.well-known/security.txt {
  67. proxy_pass "http://lemmy-ui:1234";
  68. }
  69.  
  70. # backend
  71. location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) {
  72. proxy_pass "http://lemmy:8536";
  73.  
  74. # Send actual client IP upstream
  75. include proxy_params;
  76. }
  77. }
  78.  
Advertisement
Add Comment
Please, Sign In to add comment