質問編集履歴
3
問題発生時のNginx設定ファイルの内容を追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -16,32 +16,24 @@
|
|
16
16
|
-セキュリティグループのインバウンドルールは、http ポート:80 について、すべてのアクセスを許可
|
17
17
|
|
18
18
|
■Nginxの設定
|
19
|
-
# log directory
|
20
19
|
error_log /var/www/rails/coffee/log/nginx.error.log;
|
21
20
|
access_log /var/www/rails/coffee/log/nginx.access.log;
|
22
|
-
# max body size
|
23
21
|
client_max_body_size 2G;
|
24
22
|
upstream app_server {
|
25
|
-
# for UNIX domain socket setups
|
26
23
|
server unix:/var/www/rails/coffee/tmp/sockets/.unicorn.sock fail_timeout=0;
|
27
24
|
}
|
28
25
|
server {
|
29
26
|
listen 80;
|
30
27
|
server_name xx.xxx.xxx.xxx; #Elastic IP
|
31
|
-
# nginx so increasing this is generally safe...
|
32
28
|
keepalive_timeout 5;
|
33
|
-
# path for static files
|
34
29
|
root /var/www/rails/coffee/public;
|
35
|
-
# page cache loading
|
36
30
|
try_files $uri/index.html $uri.html $uri @app;
|
37
31
|
location @app {
|
38
|
-
# HTTP headers
|
39
32
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
40
33
|
proxy_set_header Host $http_host;
|
41
34
|
proxy_redirect off;
|
42
35
|
proxy_pass http://app_server;
|
43
36
|
}
|
44
|
-
# Rails error pages
|
45
37
|
error_page 500 502 503 504 /500.html;
|
46
38
|
location = /500.html {
|
47
39
|
root /var/www/rails/coffee/public;
|
2
問題発生時のNginx設定ファイルの内容を追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,6 +14,39 @@
|
|
14
14
|
-ロードバランサーのターゲットインスタンスのElasticIPアドレスでアクセスし、hello, world!と表示されることを確認済み
|
15
15
|
-ロードバランサーのターゲットインスタンスのステータスがhealthyとなっているを確認済み
|
16
16
|
-セキュリティグループのインバウンドルールは、http ポート:80 について、すべてのアクセスを許可
|
17
|
+
|
18
|
+
■Nginxの設定
|
19
|
+
# log directory
|
20
|
+
error_log /var/www/rails/coffee/log/nginx.error.log;
|
21
|
+
access_log /var/www/rails/coffee/log/nginx.access.log;
|
22
|
+
# max body size
|
23
|
+
client_max_body_size 2G;
|
24
|
+
upstream app_server {
|
25
|
+
# for UNIX domain socket setups
|
26
|
+
server unix:/var/www/rails/coffee/tmp/sockets/.unicorn.sock fail_timeout=0;
|
27
|
+
}
|
28
|
+
server {
|
29
|
+
listen 80;
|
30
|
+
server_name xx.xxx.xxx.xxx; #Elastic IP
|
31
|
+
# nginx so increasing this is generally safe...
|
32
|
+
keepalive_timeout 5;
|
33
|
+
# path for static files
|
34
|
+
root /var/www/rails/coffee/public;
|
35
|
+
# page cache loading
|
36
|
+
try_files $uri/index.html $uri.html $uri @app;
|
37
|
+
location @app {
|
38
|
+
# HTTP headers
|
39
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
40
|
+
proxy_set_header Host $http_host;
|
41
|
+
proxy_redirect off;
|
42
|
+
proxy_pass http://app_server;
|
43
|
+
}
|
44
|
+
# Rails error pages
|
45
|
+
error_page 500 502 503 504 /500.html;
|
46
|
+
location = /500.html {
|
47
|
+
root /var/www/rails/coffee/public;
|
48
|
+
}
|
49
|
+
}
|
17
50
|
|
18
51
|
■問題点
|
19
52
|
-ELB経由でEC2へアクセスするため、作成したロードバランサーのDNS名をコピーし、ブラウザに貼り付けたところ、以下表示されてしまう
|
1
構成・バージョンに関する情報を追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
初心者エンジニアです。ローカルで作成中のWebアプリ(プロトタイプ)をAWSのEC2上にデプロイし、今後公開したいと考えております。
|
2
2
|
EC2上へのデプロイまでは確認できました(hello, world!と表示)が、ELB経由でアクセスした場合、同様の表示が返ってこないため、質問させて下さい。
|
3
3
|
|
4
|
+
■構成・バージョン
|
5
|
+
-Application Load Balancer
|
6
|
+
-AWS EC2 (Amazon Linux 2(Cent0S 7))
|
7
|
+
-Nginx(1.16.1)
|
8
|
+
-Unicorn(5.7.0)
|
9
|
+
-Ruby 2.7.2
|
10
|
+
-Rails 6.0.3.4
|
11
|
+
-RDS(MariaDB 10.4.13)
|
12
|
+
|
4
13
|
■前提
|
5
14
|
-ロードバランサーのターゲットインスタンスのElasticIPアドレスでアクセスし、hello, world!と表示されることを確認済み
|
6
15
|
-ロードバランサーのターゲットインスタンスのステータスがhealthyとなっているを確認済み
|