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
#####################################
}
0 Answers