
У меня есть работающие экземпляры, которые правильно отображают сайт на aws. Что включено для запуска сайта django, nginx, uwsgi
?elastic ip
Я создал образ экземпляров. Запускаю экземпляр, теперь у меня есть второй экземпляр, который такой же, как и первый.
Во втором случае все нормально floating ip
. Когда я ввел IP в браузер, я ожидал увидеть свой сайт, иначе просто долгая загрузка, пока не истечет время ожидания, так как я site-available
еще не сделал никаких настроек.
В любом случае, я смог увидеть только nginx
страницу приветствия. Я зашел в site-available
, ввел ip в server_name
, также настроил a dns
для subdomain
имени. После изменений я перезапустил uwsgi.
Я пробовал использовать ip
и subdomain
в браузере, но все равно показывает 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
#####################################
}