gpt4 book ai didi

nginx - 在 Nginx 上通过 https 配置 tusd 时出现问题

转载 作者:行者123 更新时间:2023-12-01 09:34:46 24 4
gpt4 key购买 nike

我正在尝试在 https 上使用 Uppy 设置 tusd,但没有成功。它在 http 上运行良好。

这是我的 nginx conf 文件:

server {
listen 80;
listen[::]: 80;
server_name
DOMAIN.com
www.DOMAIN.com;

root / srv / users / DOMAIN / apps / DOMAIN / public;

access_log / srv / users / DOMAIN / log / DOMAIN / DOMAIN_nginx.access.log main;
error_log / srv / users / DOMAIN / log / DOMAIN / DOMAIN_nginx.error.log;

proxy_set_header Host $host;
proxy_set_header X - Real - IP $remote_addr;
proxy_set_header X - Forwarded - For $proxy_add_x_forwarded_for;

include / etc / nginx - sp / vhosts.d / DOMAIN.d
/*.nonssl_conf;
include /etc/nginx-sp/vhosts.d/DOMAIN.d/*.conf;
}

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name
DOMAIN.com
www.DOMAIN.com
;

ssl_certificate_key ssl/DOMAIN.key;
ssl_certificate ssl/DOMAIN.combined_crt;

root /srv/users/DOMAIN/apps/DOMAIN/public;

access_log /srv/users/DOMAIN/log/DOMAIN/DOMAIN_nginx.access_ssl.log main;
error_log /srv/users/DOMAIN/log/DOMAIN/DOMAIN_nginx.error_ssl.log;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-SSL on;
proxy_set_header X-Forwarded-Proto $scheme;

include /etc/nginx-sp/vhosts.d/DOMAIN.d/*.ssl_conf;
include /etc/nginx-sp/vhosts.d/DOMAIN.d/*.conf;


location /files/ {
#resolver 8.8.8.8 4.2.2.2;

proxy_pass http://localhost:3020/files;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

# Disable request and response buffering
proxy_request_buffering off;
proxy_buffering off;
proxy_http_version 1.1;

# Add X-Forwarded-* headers so that response can reference https and
# originating host:port
proxy_set_header X-Forwarded-Host $hostname;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# Allow proxying of websockets if required
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
client_max_body_size 0;
}
}

在另一个 conf 文件中,我有这个额外的配置:
location / {
proxy_pass $backend_protocol://$backend_host:$backend_port;
}

在 Chrome 控制台上,我有以下输出:
upload.js:2 OPTIONS https://DOMAIN/files/2b775a112504ed1222c6ffdd4fbdac03+Dc99JI0Zvgh54FXVfpp5K32GAiZBjV5bY-d9tzj8fDL1FxNKKZrHP_SBE6OERG8SWAm1ZjqtjYMVWSvWCQLba0qsR8krfVBYw8ApHqIBO7DG9Bn1t_tv_a6nuuTuqlXC net::ERR_NAME_NOT_RESOLVED

注意没有 .com 扩展名的域!

我尝试了所有配置组合,但没有成功评论配置行。你能发现错误吗?

最佳答案

承包商为我解决了这个问题,解决方案很简洁。他做到了,而不是配置 Apache。

在第一个 nginx conf 文件中,他完全删除了“location/files/”部分。在 apache conf 文件中,他添加了以下几行:

    ProxyPass /files http://localhost:3020/files
ProxyPassReverse /files http://localhost:3020/files

它奏效了。

关于nginx - 在 Nginx 上通过 https 配置 tusd 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59511612/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com