我遇到了一个问题,我定义了几个服务器块来重定向流量。我的 nginx 配置如下:
server {
listen 80;
listen [::]:80;
server_name deflector.io www.deflector.io;
return 301 https://www.deflector.io$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name deflector.io;
return 301 https://www.deflector.io$request_uri;
ssl_certificate /etc/letsencrypt/live/deflector.io/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/deflector.io/privkey.pem; # managed by Certbot
}
server {
listen 443 ssl;
listen [::]:443 ssl;
root /home/foundation/deflector/app/build;
access_log /var/log/nginx/deflector/deflector.access.log;
server_name www.deflector.io;
location / {
try_files $uri $uri.htm $uri.html /index.html;
}
ssl_certificate /etc/letsencrypt/live/deflector.io/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/deflector.io/privkey.pem; # managed by Certbot
}
到 的流量http
运行正常,并按预期重定向,但是到 的流量https://deflector.io
被拒绝curl: (7) Failed to connect to deflector.io port 443: Connection refused
。尽管最后一个块运行正常,但情况仍然如此。
我在这里有点想不出主意了,所以如果能提供任何帮助我都会很感激。