
私はAWS上でサイトを適切に表示するインスタンスを実行しています。サイトを実行するために必要なものは次django, nginx, uwsgi
のとおりです。elastic ip
インスタンスのイメージを作成しました。インスタンスを起動すると、最初のインスタンスと同じ 2 番目のインスタンスが作成されます。
2 番目のインスタンスは通常の状態ですfloating ip
。ブラウザに IP を入力すると、自分のサイトも表示されると思っていましたが、site-available
まだ設定を行っていないため、タイムアウトするまで長い読み込み時間しかかかりませんでした。
とにかく、その後はウェルカム ページしか表示できませんでしたnginx
。 に移動しsite-available
、 に IP を入力し、名前にserver_name
を設定しました。変更後、uwsgi を再起動しました。dns
subdomain
ip
ブラウザでを使ってみましたsubdomain
が、まだnginx
ウェルカム ページが表示されます。エラーすらありません。
誰か、私が試すべき理由やアドバイスをご存知ですか?
どちらも同じ設定なので、正常に動作するはずですよね?
PS その後、elastic ip
最初のインスタンスから2番目のインスタンスに移動しようとしました...ブラウザで最初のインスタンスのドメインを使用しました...すると、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
}
2番目のインスタンスについては...を変更しserver_name
、を含めたり除外したりしてみましたssl
が、どちらも同じ結果でした
これは2番目のインスタンスの設定です
# `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
#####################################
}