There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

mcmxci ,

My nginx.conf for lemmy-nginx is below, sorry if it’s a bit messy. I prefer to comment than remove working config. You’ll have to change


<span style="color:#323232;">worker_processes 1;
</span><span style="color:#323232;">events {
</span><span style="color:#323232;">    worker_connections 1024;
</span><span style="color:#323232;">}
</span><span style="color:#323232;">http {
</span><span style="color:#323232;">#Beginning of kbin fix
</span><span style="color:#323232;"># We construct a string consistent of the "request method" and "http accept header"
</span><span style="color:#323232;">    # and then apply soem ~simply regexp matches to that combination to decide on the
</span><span style="color:#323232;">    # HTTP upstream we should proxy the request to.
</span><span style="color:#323232;">    #
</span><span style="color:#323232;">    # Example strings:
</span><span style="color:#323232;">    #
</span><span style="color:#323232;">    #   "GET:application/activity+json"
</span><span style="color:#323232;">    #   "GET:text/html"
</span><span style="color:#323232;">    #   "POST:application/activity+json"
</span><span style="color:#323232;">    #
</span><span style="color:#323232;">    # You can see some basic match tests in this regex101 matching this configuration
</span><span style="color:#323232;">    # https://regex101.com/r/vwMJNc/1
</span><span style="color:#323232;">    #
</span><span style="color:#323232;">    # Learn more about nginx maps here http://nginx.org/en/docs/http/ngx_http_map_module.html
</span><span style="color:#323232;">    map "$request_method:$http_accept" $proxpass {
</span><span style="color:#323232;">        # If no explicit matches exists below, send traffic to lemmy-ui
</span><span style="color:#323232;">        default "http://lemmy-ui";
</span><span style="color:#323232;">
</span><span style="color:#323232;">        # GET/HEAD requests that accepts ActivityPub or Linked Data JSON should go to lemmy.
</span><span style="color:#323232;">        #
</span><span style="color:#323232;">        # These requests are used by Mastodon and other fediverse instances to look up profile information,
</span><span style="color:#323232;">        # discover site information and so on.
</span><span style="color:#323232;">        "~^(?:GET|HEAD):.*?application/(?:activity|ld)+json" "http://lemmy";
</span><span style="color:#323232;">
</span><span style="color:#323232;">        # All non-GET/HEAD requests should go to lemmy
</span><span style="color:#323232;">        #
</span><span style="color:#323232;">        # Rather than calling out POST, PUT, DELETE, PATCH, CONNECT and all the verbs manually
</span><span style="color:#323232;">        # we simply negate the GET|HEAD pattern from above and accept all possibly $http_accept values
</span><span style="color:#323232;">        "~^(?!(GET|HEAD)).*:" "http://lemmy";
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">### end of kbin fix
</span><span style="color:#323232;">    upstream lemmy {
</span><span style="color:#323232;">        # this needs to map to the lemmy (server) docker service hostname
</span><span style="color:#323232;">        server "lemmy:8536";
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">    upstream lemmy-ui {
</span><span style="color:#323232;">        # this needs to map to the lemmy-ui docker service hostname
</span><span style="color:#323232;">        server "lemmy-ui:1234";
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">
</span><span style="color:#323232;">    server {
</span><span style="color:#323232;">        # this is the port inside docker, not the public one yet
</span><span style="color:#323232;">        listen 1236;
</span><span style="color:#323232;">        listen 8536;
</span><span style="color:#323232;">        # change if needed, this is facing the public web
</span><span style="color:#323232;">        #server_name localhost;
</span><span style="color:#323232;">	server_name ;
</span><span style="color:#323232;">        server_tokens off;
</span><span style="color:#323232;">
</span><span style="color:#323232;">        gzip on;
</span><span style="color:#323232;">        gzip_types text/css application/javascript image/svg+xml;
</span><span style="color:#323232;">        gzip_vary on;
</span><span style="color:#323232;">
</span><span style="color:#323232;">        # Upload limit, relevant for pictrs
</span><span style="color:#323232;">        client_max_body_size 100M;
</span><span style="color:#323232;">
</span><span style="color:#323232;">        add_header X-Frame-Options SAMEORIGIN;
</span><span style="color:#323232;">        add_header X-Content-Type-Options nosniff;
</span><span style="color:#323232;">        add_header X-XSS-Protection "1; mode=block";
</span><span style="color:#323232;">
</span><span style="color:#323232;">        # frontend general requests
</span><span style="color:#323232;">        location / {
</span><span style="color:#323232;">            # distinguish between ui requests and backend
</span><span style="color:#323232;">            # don't change lemmy-ui or lemmy here, they refer to the upstream definitions on top
</span><span style="color:#323232;">#            set $proxpass "http://lemmy-ui";
</span><span style="color:#323232;">
</span><span style="color:#323232;">#            if ($http_accept = "application/activity+json") {
</span><span style="color:#323232;">#              set $proxpass "http://lemmy";
</span><span style="color:#323232;">#            }
</span><span style="color:#323232;">#            if ($http_accept = "application/ld+json; profile="https://www.w3.org/ns/activitystreams"") {
</span><span style="color:#323232;">#              set $proxpass "http://lemmy";
</span><span style="color:#323232;">#            }
</span><span style="color:#323232;">#            if ($request_method = POST) {
</span><span style="color:#323232;">#              set $proxpass "http://lemmy";
</span><span style="color:#323232;">#            }
</span><span style="color:#323232;">            proxy_pass $proxpass;
</span><span style="color:#323232;">
</span><span style="color:#323232;">            rewrite ^(.+)/+$ $1 permanent;
</span><span style="color:#323232;">            # Send actual client IP upstream
</span><span style="color:#323232;">            proxy_set_header X-Real-IP $remote_addr;
</span><span style="color:#323232;">            proxy_set_header Host $host;
</span><span style="color:#323232;">            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
</span><span style="color:#323232;">        }
</span><span style="color:#323232;">
</span><span style="color:#323232;">        # backend
</span><span style="color:#323232;">        location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) {
</span><span style="color:#323232;">            proxy_pass "http://lemmy";
</span><span style="color:#323232;">            # proxy common stuff
</span><span style="color:#323232;">            proxy_http_version 1.1;
</span><span style="color:#323232;">            proxy_set_header Upgrade $http_upgrade;
</span><span style="color:#323232;">            proxy_set_header Connection "upgrade";
</span><span style="color:#323232;">
</span><span style="color:#323232;">            # Send actual client IP upstream
</span><span style="color:#323232;">            proxy_set_header X-Real-IP $remote_addr;
</span><span style="color:#323232;">            proxy_set_header Host $host;
</span><span style="color:#323232;">            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
</span><span style="color:#323232;">        }
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}
</span><span style="color:#323232;">#error_log /var/log/nginx/error.log debug;
</span>
  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines