質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Django

DjangoはPythonで書かれた、オープンソースウェブアプリケーションのフレームワークです。複雑なデータベースを扱うウェブサイトを開発する際に必要な労力を減らす為にデザインされました。

AWS Glue

AWS Glueは、分析のためのデータの抽出や変換、ロードを簡単にするフルマネージド型のサービスです。データ処理の自動化の他、データ収集やETL処理も自動化・サーバレス化することが可能。AWSに保存したデータを指定すると、AWS Glueでデータ検索することもできます。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

Q&A

0回答

325閲覧

django で作成したアプリをAWSにデプロイできない

ifaoerij

総合スコア34

Django

DjangoはPythonで書かれた、オープンソースウェブアプリケーションのフレームワークです。複雑なデータベースを扱うウェブサイトを開発する際に必要な労力を減らす為にデザインされました。

AWS Glue

AWS Glueは、分析のためのデータの抽出や変換、ロードを簡単にするフルマネージド型のサービスです。データ処理の自動化の他、データ収集やETL処理も自動化・サーバレス化することが可能。AWSに保存したデータを指定すると、AWS Glueでデータ検索することもできます。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

0グッド

0クリップ

投稿2020/11/02 12:09

編集2020/11/02 12:17

https://www.amazon.co.jp/%E5%8B%95%E3%81%8B%E3%81%97%E3%81%A6%E5%AD%A6%E3%81%B6-Python-Django%E9%96%8B%E7%99%BA%E5%85%A5%E9%96%80-NEXT-ONE/dp/4798162507

上記の技術書を元に、djangoで作成したアプリをAWSにデプロイしようとしています。
nginxをインスタンスしてアプリケーションサーバーの設定を行ったのですが、
そもそもhttp://EIP/を入力しても、ページが見つかりませんと表示がされ、原因の切り分けができず困っています。
セキュリティーグループでHttpの許可は行っています。
ご教示頂けませんでしょうか?

■実行したコマンド

sudo systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since 月 2020-11-02 17:24:20 JST; 3h 43min ago
Process: 4310 ExecReload=/bin/kill -s HUP $MAINPID (code=exited, status=0/SUCCESS)
Process: 2177 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 2174 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 2173 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 2180 (nginx)
CGroup: /system.slice/nginx.service
├─2180 nginx: master process /usr/sbin/nginx
└─4312 nginx: worker process

11月 02 17:24:20 ip-10-0-0-11.us-east-2.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy server...
11月 02 17:24:20 ip-10-0-0-11.us-east-2.compute.internal nginx[2174]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
11月 02 17:24:20 ip-10-0-0-11.us-east-2.compute.internal nginx[2174]: nginx: configuration file /etc/nginx/nginx.conf test is successful
11月 02 17:24:20 ip-10-0-0-11.us-east-2.compute.internal systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument
11月 02 17:24:20 ip-10-0-0-11.us-east-2.compute.internal systemd[1]: Started The nginx HTTP and reverse proxy server.
11月 02 20:53:48 ip-10-0-0-11.us-east-2.compute.internal systemd[1]: Reloaded The nginx HTTP and reverse proxy server.

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

ps aux | grep nginx
root 2180 0.0 0.2 125752 2232 ? Ss 17:24 0:00 nginx: master process /usr/sbin/nginx
nginx 2182 0.0 0.4 126200 5016 ? S 17:24 0:00 nginx: worker process
ec2-user 4289 0.0 0.0 119436 904 pts/1 S+ 20:49 0:00 grep --color=auto nginx
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
ps ax |grep gunicorn
4396 pts/1 S+ 0:00 grep --color=auto gunicorn
→アプリケーションサーバーが起動していない

/etc/nginx/nginx.conf

# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 4096; include /etc/nginx/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; server { listen 80; server_name ec2のEIP; root /usr/share/nginx/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location /static{ alias /usr/share/nginx/html/static; } location /media{ alias /usr/share/nginx/hmtl/media; } location / { proxy_pass http://127.0.0.1:8000; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Forwarded-Proto $scheme; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } } # Settings for a TLS enabled server. # # server { # listen 443 ssl http2; # listen [::]:443 ssl http2; # server_name _; # root /usr/share/nginx/html; # # ssl_certificate "/etc/pki/nginx/server.crt"; # ssl_certificate_key "/etc/pki/nginx/private/server.key"; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 10m; # ssl_ciphers PROFILE=SYSTEM; # ssl_prefer_server_ciphers on;

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問