2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ELBを利用したEC2インスタンスに、Djangoをデプロイする際のHOST問題

2
Last updated at Posted at 2019-06-06

ホスト名を記述しておかないと、アクセスできない件

この場合、下記2点を予めsettings.pyのALLOWED_HOSTSに記載しないとアクセスが拒否される現象が発生します。

  • ELBのDNS name
  • EC2のPrivate IPs

ちなみに、ELBのDNSを独自ドメインで利用する場合(CNAMEを使用)、そのドメイン名をDNS nameの代わりに記入する必要があります。(例:お名前ドットコムのドメイン名を使用したい)

settings.py
ALLOWED_HOSTS = ['ELBのDNS', 'EC2のprivateIP']
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?