Cloudfront URL 路由到域

Cloudfront URL 路由到域

我有一个 cloudfront url,我想将其路由到 demo.example.com。我使用 nginx 进行路由和配置,并生成了 ssl 证书,然后在 DNS 门户中添加了 txt 记录。

但是当我尝试访问它时,它显示DNS_PROBE_FINISHED_NXDOMAIN错误ERR_TOO_MANY_REDIRECTS。我可能认为可能是 nginx 服务器的配置错误。

我的配置如下

 upstream apjpro_server_cloudfront {
               server d2yfna2c83xhjx.cloudfront.net;
}


'##demo.apjpro.com (cloudfront)
    server {
            listen 80;
            server_name demo.apjpro.com;
            location / {

                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header Host $host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_connect_timeout       300;
                    proxy_send_timeout          300;
                    proxy_read_timeout          300;
                    send_timeout                300;
                    proxy_pass http://apjpro_server_cloudfront;
            }
           }
    server {
            listen 443;
            server_name demo.apjpro.com;
            ssl on;
            ssl_certificate /etc/letsencrypt/live/demo.apjpro.com/fullchain.pem;
            ssl_certificate_key /etc/letsencrypt/live/demo.apjpro.com/privkey.pem;
            ssl_protocols               TLSv1.1 TLSv1.2;

            location / {
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header Host $host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_connect_timeout       300;
                    proxy_send_timeout          300;
                    proxy_read_timeout          300;
                    send_timeout                300;
                    proxy_ssl_server_name on;
                    proxy_pass http://apjpro_server_cloudfront;
            }

    }

相关内容