
Ich habe eine laufende Instanz, die die Site auf AWS richtig anzeigt. Was zum Ausführen der Site enthalten ist, ist django, nginx, uwsgi
mitelastic ip
Ich habe ein Image der Instanzen erstellt. Starten Sie die Instanz, und jetzt habe ich eine zweite Instanz, die mit der ersten identisch ist.
Die zweite Instanz hat nur normal floating ip
. Als ich die IP in den Browser eingebe, habe ich erwartet, auch meine Site zu sehen, sonst nur eine lange Ladezeit bis zum Timeout, da ich noch keine Konfigurationen vorgenommen habe site-available
.
Wie auch immer, ich konnte dann nur die nginx
Willkommensseite sehen. Ich ging zu site-available
, gab die IP ein server_name
und richtete auch ein dns
für einen subdomain
Namen ein. Nach den Änderungen startete ich uwsgi neu.
Ich habe versucht, ip
und subdomain
im Browser zu verwenden, aber es wird immer noch die nginx
Willkommensseite angezeigt. Es liegt nicht einmal ein Fehler vor.
Hat jemand eine Idee, warum das so ist, oder einen Rat, was ich versuchen soll?
Es handelt sich in beiden Fällen um die gleichen Einstellungen. Sollte es nicht ordnungsgemäß funktionieren?
PS: Ich habe dann versucht, elastic ip
von der ersten Instanz zur zweiten Instanz zu wechseln. Ich habe die Domäne der ersten Instanz im Browser verwendet. Dann wird meine Site angezeigt und nicht die nginx
Willkommensseite.
site-available
für die Originalinstanz, die perfekt funktioniert
# `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
}
was die zweiten Fälle betrifft ... ich habe das geändert server_name
und versucht, das einzuschließen und auszuschließen, ssl
aber beides das gleiche Ergebnis
Dies ist die Konfiguration für die zweite Instanz
# `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
#####################################
}