0

I have a running instances which shows the site properly on aws. what's included to run the site are django, nginx, uwsgi with elastic ip

I have created an image of the instances. Launch the instance which now I have a second instance which is the same as the first one.

The second instance just have normal floating ip. When I input the ip into the browser, I was expecting to see my site too else just a long loading until it timeout since I didn't do any configurations in site-available yet.

Anyways, I was then able to see only the nginx welcome page. I went to the site-available, put the ip into server_name, also I setup a dns for a subdomain name. After the changes, I restarted uwsgi.

I tried using ip and subdomain on browser, but still showing the nginx welcome page. There isn't even an error.

Does someone have any idea why or advice what I do try?

They are both the same settings, shouldn't it work properly?

P.S. I then tried moving the elastic ip from first instance to the second instance...I used the domain of first instance in browser...then my site pops up not the nginx welcome page

site-available for the original instance which works perfectly

# `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


}

as for the second instances...I changed the server_name and I tried including and excluding the ssl but both the same result

this is the config for the second instance

# `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
    #####################################

}
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
Dora
  • 341
  • 1
  • 5
  • 15
  • Isn't `ec2` about cloud server? why is it off topic? – Dora Mar 09 '18 at 01:15
  • I believe the reason it was put on hold is because you haven't given enough information for anyone to help you. Typically we would expect to see configurations and error logs. Don't just give us a bunch of logs, do a request and include relevant logs. That might inform you about which configurations would help to diagnose the problems. – Tim Mar 09 '18 at 03:32
  • @Tim got it ^_^, I will edit and add in the config in `site-available` just that there is no error logs, which gets me totally confused and no idea where to start since the second one is a duplicate – Dora Mar 09 '18 at 18:24
  • I would try a few things 1) Triple check the files exist as expected and permissions are correct for web server to access them 2) Check that you have the correct instance of nginx running - there might be more than one installed 3) Change your server_name to "server_name _;" to see if it makes any difference (probably won't). 4) Check the access log to see if anything interesting is in there 5) See if the access log can be configured to show where the file served comes from – Tim Mar 09 '18 at 19:38
  • @Tim thanks for the info, let me give those a try. – Dora Mar 09 '18 at 19:47

0 Answers0