Skip to content

Instantly share code, notes, and snippets.

@imShara
Created August 16, 2019 18:41
Show Gist options
  • Save imShara/3fb8ed30b4faeeabeac5e4e6772acab6 to your computer and use it in GitHub Desktop.
Save imShara/3fb8ed30b4faeeabeac5e4e6772acab6 to your computer and use it in GitHub Desktop.
Ejabberd (19.08+) mod_http_upload and Nginx reverse-proxy

If we have xmpp server on host domain.tld and want serve files from https://xmpp.domain.tld/upload/…

/etc/ejabberd/ejabberd.yml


listen
  port: 5280
  ip: "127.0.0.1"
  module: ejabberd_http
    request_handlers:
      "/upload": mod_http_upload

  mod_http_upload:
    host: "xmpp.@HOST@"
    docroot: "/srv/ejabberd/uploads"
    put_url: "https://xmpp.@HOST@/upload"
 

/etc/nginx/sites-enabled/xmpp.domain.tld

location / {
    proxy_set_header Host $host;
    proxy_pass http://127.0.0.1:5280;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment