aws 克隆的 ec2 只显示 nginx 默认页面为什么?

aws 克隆的 ec2 只显示 nginx 默认页面为什么?

我有一个正在运行的实例,可以在 AWS 上正确显示该网站。运行该网站所需的内容django, nginx, uwsgi包括elastic ip

我已经创建了实例的映像。启动该实例,现在我有了第二个实例,它与第一个实例相同。

第二个实例只是正常floating ip。当我将 IP 输入浏览器时,我希望也能看到我的网站,但由于我尚未进行任何配置,因此只需长时间加载即可,直到超时site-available

无论如何,我当时只能看到nginx欢迎页面。我转到site-available,将 ip 输入server_name,还设置了dnssubdomain名称。更改后,我重新启动了 uwsgi。

我尝试在浏览器上使用ipsubdomain但仍然显示nginx欢迎页面。甚至没有错误。

有人知道为什么或者建议我该尝试什么吗?

都是相同的设置,不是应该可以正常工作吗?

PS 然后我尝试将其elastic ip从第一个实例移动到第二个实例...我在浏览器中使用了第一个实例的域...然后弹出我的网站而不是nginx欢迎页面

site-available对于原始实例,它运行完美

# `gzip` Settings
#
#
# gzip on;
# gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;


# configuration of the server
server {
    # the port your site will be served on
    listen      80;

    # the domain name it will serve for
    server_name  xxx.xxx.xxx.xxx subdomain.domain.com; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 25M;   # adjust to taste

    # Django media
    location /media  {
        alias /home/ubuntu/appName/appName/mediafiles;  # your Django project's media files - amend as required
    }

    location /static {
        alias /home/ubuntu/appName/appName/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  unix:/tmp/appName.sock;
        include     /home/ubuntu/appName/appName/uwsgi_params; # the uwsgi_params file you installed
    #add_header 'Access-Control-Allow-Origin' '*';
    }




    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/subdomain.domain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/subdomain.domain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot


    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    } # managed by Certbot


}

至于第二个实例...我改变了server_name,并尝试包括和排除,ssl但结果相同

这是第二个实例的配置

# `gzip` Settings
#
#
# gzip on;
# gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;


# configuration of the server
server {
    # the port your site will be served on
    listen      80;

    # the domain name it will serve for
    server_name  xx2.xx2.xx2.xx2 subdomain2.domain2.com; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 25M;   # adjust to taste

    # Django media
    location /media  {
        alias /home/ubuntu/appName/appName/mediafiles;  # your Django project's media files - amend as required
    }

    location /static {
        alias /home/ubuntu/appName/appName/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  unix:/tmp/appName.sock;
        include     /home/ubuntu/appName/appName/uwsgi_params; # the uwsgi_params file you installed
    #add_header 'Access-Control-Allow-Origin' '*';
    }


    #####################################
    # TRIED INCLUDING AND EXCLUDING SLL
    #####################################
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/subdomain2.domain2.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/subdomain2.domain2.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot


    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    #####################################
    # TRIED INCLUDING AND EXCLUDING SLL
    #####################################

}

相关内容