首页 > 解决方案 > AWS EC2 S3 冲突

问题描述

嗨,我在创建一个托管 AngularJs 应用程序的 EC2 实例时遇到了很大的麻烦,为了缩短它,我有一个具有弹性 ip 和域名的 EC2 实例http://dev.mydomain.net(机器安装了 Nginx)我的工作区由 Jenkins 复制到名为S3.dev.mydomain.netbacked的 S3 存储桶通过 CDN 分发,我的目标是创建一个新域名(dev2.mydomain.net),所以我从第一个实例创建了一个图像以及另一个 S3 存储桶,它是 CDN,问题是每当我尝试使用从外部访问 Angular 应用程序时,http://dev2.mydomain.net我都会被重定向到 Nginx欢迎页面!每当我尝试使用新创建的实例公共 dns 访问应用程序时,我都会被证书捕获NET::ERR_CERT_COMMON_NAME_INVALID

假设新创建的实例具有与原始实例相同的安全配置文件,我还浏览了所有 AWS 服务,以了解实际如何http:dev.mydomain.net链接到原始实例的弹性 ip,但我不明白,不知道我错过了什么

更新:原始实例的 Nginx conf:

user                    nginx;
error_log               /var/log/nginx/error.log warn;
pid                     /var/run/nginx.pid;
worker_processes        auto;
worker_rlimit_nofile    133916;

events {
worker_connections  1024;
}

http {
include       /etc/nginx/mime.types;
default_type  application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

include       conf.d/*.conf;

map $http_upgrade $connection_upgrade {
    default     "upgrade";
}

server {
    listen        80 default_server;
    access_log    /var/log/nginx/access.log main;

    client_header_timeout 60;
    client_body_timeout   60;
    keepalive_timeout     60;
    gzip                  off;
    gzip_comp_level       4;
    gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    # Include the Elastic Beanstalk generated locations
    include conf.d/elasticbeanstalk/*.conf;
 }
}

标签: amazon-web-servicesamazon-s3amazon-ec2amazon-cloudfront

解决方案


推荐阅读