0

所以我使用韵律设置了一个 XMPP 服务器,我希望使用 mynginx 服务器通过 http 提供文件。prosody.cfg.lua 中的相关片段是:

http_interfaces = { "127.0.0.1" }
--https_interfaces = { "127.0.0.1", "::1" }
--trusted_proxies = { "127.0.0.1", "::1", "192.168.15.18" }

VirtualHost "silosneeded.com"

disco_items = {
   {"uploads.silosneeded.com"},
}

Component "uploads.silosneeded.com" "http_upload"
   http_host = "uploads.silosneeded.com"
   http_external_url = "https://uploads.silosneeded.com"
   http_upload_expire_after = 60 * 60 * 24 * 14

nginx 尝试服务的服务器配置是:

server {
    server_tokens off;              # hide server tokens
    server_name uploads.silosneeded.com; # subdomain for http upload

    listen 443 ssl;
    listen [::]:443 ssl;

    root /var/www/html;             # your default serving directory

    location /upload {
      proxy_buffering off;
      proxy_set_header Host $host;

      # pass PUT requests to mod_http_upload for processing
      if ($request_method = PUT) {
        proxy_pass http://127.0.0.1:5280;
      }

      alias /var/lib/prosody/http_upload;  # storage path of mod_http_upload. NGINX will serve these files to the clients.
    }

    client_max_body_size 10m;

    # certificate management here
    ssl_certificate /etc/letsencrypt/live/uploads.silosneeded.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/uploads.silosneeded.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

韵律日志表明 http_upload 模块正在寻找https://uploads.silosneeded.com/upload。当尝试执行 PUT 请求(例如发送图像)时,nginx 日志状态如下:

192.168.15.20 - - [10/Nov/2021:11:06:23 -0600] "PUT /upload/I-anZT9hV-t-EgnO/xenix.gif HTTP/1.1" 404 125 "-" "-"

需要考虑的事情:我或多或少地遵循了本教程:https ://error418.github.io/server/2021/01/20/xmpp-nginx.html所以每个目录都有正确的权限。客户端(我的 PC)和服务器都在同一个 LAN 中。我可以访问https://uploads.silosneeded.com没问题。

4

0 回答 0