{"id":16156321,"url":"https://github.com/weiss/ngx_http_upload","last_synced_at":"2025-03-18T20:30:36.084Z","repository":{"id":38384979,"uuid":"141491145","full_name":"weiss/ngx_http_upload","owner":"weiss","description":"Nginx module to handle file uploads and downloads for XMPP servers","archived":false,"fork":false,"pushed_at":"2022-06-05T13:01:30.000Z","size":15,"stargazers_count":39,"open_issues_count":2,"forks_count":9,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-16T23:34:20.748Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weiss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-18T21:16:23.000Z","updated_at":"2025-02-25T03:49:58.000Z","dependencies_parsed_at":"2022-08-18T19:10:41.051Z","dependency_job_id":null,"html_url":"https://github.com/weiss/ngx_http_upload","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiss%2Fngx_http_upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiss%2Fngx_http_upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiss%2Fngx_http_upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiss%2Fngx_http_upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weiss","download_url":"https://codeload.github.com/weiss/ngx_http_upload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244301223,"owners_count":20430905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T01:44:37.124Z","updated_at":"2025-03-18T20:30:35.826Z","avatar_url":"https://github.com/weiss.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"upload.pm\n=========\n\nThis [Nginx][1] module implements the HTTP server's part of the XMPP extension\n[XEP-0363: HTTP File Upload][2]. It can be used with either ejabberd's\n[`mod_http_upload`][3] or Prosody's [`mod_http_upload_external`][4].\n\nNginx setup\n-----------\n\n1. Create a directory and move `upload.pm` into it, e.g.:\n\n    ```sh\n    # mkdir -p /usr/local/lib/perl\n    # wget -O /usr/local/lib/perl/upload.pm https://git.io/fNZgL\n    ```\n\n2. Install the [`ngx_http_perl_module`][5]. On Debian/Ubuntu-based\n   distributions, the package is called `libnginx-mod-http-perl`, on\n   RedHat/CentOS-based distributions, it's `nginx-mod-http-perl`.\n   If you're using Docker, make sure you use the image ending in `-perl`.\n\n3. Add the following snippets to the appropriate sections of your Nginx\n   configuration:\n\n    ```nginx configuration file\n    # This directive was probably added by the distribution package already:\n    load_module modules/ngx_http_perl_module.so;\n\n    http {\n        # Add the following two lines to the existing \"http\" block.\n        perl_modules /usr/local/lib/perl; # Path to upload.pm.\n        perl_require upload.pm;\n    }\n\n    server {\n        # Specify directives such as \"listen\", \"server_name\", and TLS-related\n        # settings for the \"server\" that handles the uploads.\n\n        # Uploaded files will be stored below the \"root\" directory. To minimize\n        # disk I/O, make sure the specified path is on the same file system as\n        # the directory used by Nginx to store temporary files holding request\n        # bodies (\"client_body_temp_path\", often some directory below /var).\n        root /var/www/upload;\n\n        # Specify this \"location\" block (if you don't use \"/\", see below):\n        location / {\n            perl upload::handle;\n        }\n\n        # Upload file size limit (default: 1m), also specified in your XMPP\n        # server's upload module configuration (see below):\n        client_max_body_size 100m;\n    }\n    ```\n\n4. Open `upload.pm` in an editor and adjust the configuration at the top of the\n   file:\n\n   - The `$external_secret` must match the one specified in your XMPP server's\n     upload module configuration (see below).\n\n   - If the root path of the upload URIs (the `location` specified in the Nginx\n     `server` block) isn't `/` but `/some/prefix/`, `$uri_prefix_components`\n     must be set to the number of directory levels. So, for `/some/prefix/`, it\n     would be `2`.\n\nejabberd setup\n--------------\n\nLet the [`mod_http_upload`][3] option `put_url` point to Nginx, and specify\nexactly the same `external_secret` as in the `upload.pm` settings:\n\n```yaml\nmodules:\n  mod_http_upload:\n    put_url: \"https://upload.example.com\"\n    external_secret: \"it-is-secret\"\n    max_size: 104857600 # 100 MiB, also specified in the Nginx configuration.\n```\n\nProsody setup\n-------------\n\nLet the [`mod_http_upload_external`][4] option `http_upload_external_base_url`\npoint to Nginx, and specify exactly the same `http_upload_external_secret` as in\nthe `upload.pm` settings:\n\n```lua\nhttp_upload_external_base_url = \"https://upload.example.com\"\nhttp_upload_external_secret = \"it-is-secret\"\nhttp_upload_external_file_size_limit = 104857600 -- 100 MiB\n```\n\nContact\n-------\n\nIf you have any questions, you could ask in the ejabberd room:\n`ejabberd@conference.process-one.net` (the maintainer of this module is usually\njoined as _Holger_).\n\n[1]: https://nginx.org/en/\n[2]: https://xmpp.org/extensions/xep-0363.html\n[3]: https://docs.ejabberd.im/admin/configuration/#mod-http-upload\n[4]: https://modules.prosody.im/mod_http_upload_external.html#implementation\n[5]: https://nginx.org/en/docs/http/ngx_http_perl_module.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweiss%2Fngx_http_upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweiss%2Fngx_http_upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweiss%2Fngx_http_upload/lists"}