質問編集履歴
2
設定の詳細の追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,15 @@
|
|
6
6
|
|
7
7
|
### 起きている問題
|
8
8
|
|
9
|
-
telnetコマンドで80ポートに接続できない
|
9
|
+
~~telnetコマンドで80ポートに接続できない~~
|
10
|
+
|
11
|
+
↓
|
12
|
+
|
13
|
+
telnetコマンドで80ポートに接続できたものの、EC2インスタンス上でcurlコマンドを使ってlocalhost/静的なページに接続しても
|
14
|
+
|
15
|
+
「ページが見つからない」となってしまう。(詳細ログは下記)
|
16
|
+
|
17
|
+
|
10
18
|
|
11
19
|
|
12
20
|
|
@@ -40,6 +48,406 @@
|
|
40
48
|
|
41
49
|
となり、ファイアウォールの問題?と、思いセキュリティグループを確認しましたが、原因を見つけられず。。
|
42
50
|
|
51
|
+
↓
|
52
|
+
|
53
|
+
nginxの再起動で接続できた。
|
54
|
+
|
55
|
+
```ここに言語を入力
|
56
|
+
|
57
|
+
tanaberyouni@tanaberyouninoMacBook-Air ~ % telnet 35.72.xxx.x 80
|
58
|
+
|
59
|
+
Trying 35.72.xxx.x...
|
60
|
+
|
61
|
+
Connected to ec2-35-72-xxx-x.ap-northeast-1.compute.amazonaws.com.
|
62
|
+
|
63
|
+
Escape character is '^]'.
|
64
|
+
|
65
|
+
^CConnection closed by foreign host.
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
```
|
70
|
+
|
71
|
+
EC2インスタンス上からcurlコマンドでlocalhostに接続
|
72
|
+
|
73
|
+
```ここに言語を入力
|
74
|
+
|
75
|
+
[ryoji@ip-10-0-0-225 tempo]$ curl http://localhost/
|
76
|
+
|
77
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
78
|
+
|
79
|
+
<html>
|
80
|
+
|
81
|
+
<head>
|
82
|
+
|
83
|
+
<title>Welcome to Amazon Linux 2</title>
|
84
|
+
|
85
|
+
<style rel="stylesheet" type="text/css">
|
86
|
+
|
87
|
+
html { background-color: white; font-family: "DejaVu Sans", "Liberation Sans", sans-serif; margin: 10% 20%; }
|
88
|
+
|
89
|
+
body { margin:0; padding:0; background: white; }
|
90
|
+
|
91
|
+
a { color: #007eb9; }
|
92
|
+
|
93
|
+
</style>
|
94
|
+
|
95
|
+
</head>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<body>
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<p>Thank you for using <a href="https://aws.amazon.com/amazon-linux-2/">Amazon Linux 2</a>.<p>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<p>Now that you have it installed, find announcements and discussion in <a href="https://forums.aws.amazon.com/forum.jspa?forumID=228">the AWS Discussion Forums</a>. Also try <a href="https://aws.amazon.com/documentation/">AWS documentation</a>.</p>
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
</body>
|
112
|
+
|
113
|
+
</html>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
```
|
118
|
+
|
119
|
+
同様に localhost/静的なページ に接続
|
120
|
+
|
121
|
+
```ここに言語を入力
|
122
|
+
|
123
|
+
[ryoji@ip-10-0-0-225 tempo]$ curl http://localhost/owners/new
|
124
|
+
|
125
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
130
|
+
|
131
|
+
<head>
|
132
|
+
|
133
|
+
<title>The page is not found</title>
|
134
|
+
|
135
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
136
|
+
|
137
|
+
<style type="text/css">
|
138
|
+
|
139
|
+
/*<![CDATA[*/
|
140
|
+
|
141
|
+
body {
|
142
|
+
|
143
|
+
background-color: #fff;
|
144
|
+
|
145
|
+
color: #000;
|
146
|
+
|
147
|
+
font-size: 0.9em;
|
148
|
+
|
149
|
+
font-family: sans-serif,helvetica;
|
150
|
+
|
151
|
+
margin: 0;
|
152
|
+
|
153
|
+
padding: 0;
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
:link {
|
158
|
+
|
159
|
+
color: #c00;
|
160
|
+
|
161
|
+
}
|
162
|
+
|
163
|
+
:visited {
|
164
|
+
|
165
|
+
color: #c00;
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
a:hover {
|
170
|
+
|
171
|
+
color: #f50;
|
172
|
+
|
173
|
+
}
|
174
|
+
|
175
|
+
h1 {
|
176
|
+
|
177
|
+
text-align: center;
|
178
|
+
|
179
|
+
margin: 0;
|
180
|
+
|
181
|
+
padding: 0.6em 2em 0.4em;
|
182
|
+
|
183
|
+
background-color: #294172;
|
184
|
+
|
185
|
+
color: #fff;
|
186
|
+
|
187
|
+
font-weight: normal;
|
188
|
+
|
189
|
+
font-size: 1.75em;
|
190
|
+
|
191
|
+
border-bottom: 2px solid #000;
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
h1 strong {
|
196
|
+
|
197
|
+
font-weight: bold;
|
198
|
+
|
199
|
+
font-size: 1.5em;
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
h2 {
|
204
|
+
|
205
|
+
text-align: center;
|
206
|
+
|
207
|
+
background-color: #3C6EB4;
|
208
|
+
|
209
|
+
font-size: 1.1em;
|
210
|
+
|
211
|
+
font-weight: bold;
|
212
|
+
|
213
|
+
color: #fff;
|
214
|
+
|
215
|
+
margin: 0;
|
216
|
+
|
217
|
+
padding: 0.5em;
|
218
|
+
|
219
|
+
border-bottom: 2px solid #294172;
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
h3 {
|
224
|
+
|
225
|
+
text-align: center;
|
226
|
+
|
227
|
+
background-color: #ff0000;
|
228
|
+
|
229
|
+
padding: 0.5em;
|
230
|
+
|
231
|
+
color: #fff;
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
hr {
|
236
|
+
|
237
|
+
display: none;
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
.content {
|
242
|
+
|
243
|
+
padding: 1em 5em;
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
.alert {
|
248
|
+
|
249
|
+
border: 2px solid #000;
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
img {
|
256
|
+
|
257
|
+
border: 2px solid #fff;
|
258
|
+
|
259
|
+
padding: 2px;
|
260
|
+
|
261
|
+
margin: 2px;
|
262
|
+
|
263
|
+
}
|
264
|
+
|
265
|
+
a:hover img {
|
266
|
+
|
267
|
+
border: 2px solid #294172;
|
268
|
+
|
269
|
+
}
|
270
|
+
|
271
|
+
.logos {
|
272
|
+
|
273
|
+
margin: 1em;
|
274
|
+
|
275
|
+
text-align: center;
|
276
|
+
|
277
|
+
}
|
278
|
+
|
279
|
+
/*]]>*/
|
280
|
+
|
281
|
+
</style>
|
282
|
+
|
283
|
+
</head>
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
<body>
|
288
|
+
|
289
|
+
<h1><strong>nginx error!</strong></h1>
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
<div class="content">
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
<h3>The page you are looking for is not found.</h3>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
<div class="alert">
|
302
|
+
|
303
|
+
<h2>Website Administrator</h2>
|
304
|
+
|
305
|
+
<div class="content">
|
306
|
+
|
307
|
+
<p>Something has triggered missing webpage on your
|
308
|
+
|
309
|
+
website. This is the default 404 error page for
|
310
|
+
|
311
|
+
<strong>nginx</strong> that is distributed with
|
312
|
+
|
313
|
+
Fedora. It is located
|
314
|
+
|
315
|
+
<tt>/usr/share/nginx/html/404.html</tt></p>
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
<p>You should customize this error page for your own
|
320
|
+
|
321
|
+
site or edit the <tt>error_page</tt> directive in
|
322
|
+
|
323
|
+
the <strong>nginx</strong> configuration file
|
324
|
+
|
325
|
+
<tt>/etc/nginx/nginx.conf</tt>.</p>
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
</div>
|
330
|
+
|
331
|
+
</div>
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
<div class="logos">
|
336
|
+
|
337
|
+
<a href="http://nginx.net/"><img
|
338
|
+
|
339
|
+
src="/nginx-logo.png"
|
340
|
+
|
341
|
+
alt="[ Powered by nginx ]"
|
342
|
+
|
343
|
+
width="121" height="32" /></a>
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
<a href="http://fedoraproject.org/"><img
|
348
|
+
|
349
|
+
src="/poweredby.png"
|
350
|
+
|
351
|
+
alt="[ Powered by Fedora ]"
|
352
|
+
|
353
|
+
width="88" height="31" /></a>
|
354
|
+
|
355
|
+
</div>
|
356
|
+
|
357
|
+
</div>
|
358
|
+
|
359
|
+
</body>
|
360
|
+
|
361
|
+
</html>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
```
|
366
|
+
|
367
|
+
となり、nginxエラー?
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
nginxのアクセスログをいったん見にいく
|
372
|
+
|
373
|
+
```nginx/access.log
|
374
|
+
|
375
|
+
127.0.0.1 - - [10/May/2021:08:27:24 +0000] "GET / HTTP/1.1" 200 732 "-" "curl/7.61.1" "-"
|
376
|
+
|
377
|
+
127.0.0.1 - - [10/May/2021:08:27:44 +0000] "GET /owners/new HTTP/1.1" 404 3650 "-" "curl/7.61.1" "-"
|
378
|
+
|
379
|
+
```
|
380
|
+
|
381
|
+
### nginxの設定
|
382
|
+
|
383
|
+
```ここに言語を入力
|
384
|
+
|
385
|
+
# log directory
|
386
|
+
|
387
|
+
error_log /var/www/rails/tempo/log/nginx.error.log;
|
388
|
+
|
389
|
+
access_log /var/www/rails/tempo/log/nginx.access.log;
|
390
|
+
|
391
|
+
# max body size
|
392
|
+
|
393
|
+
client_max_body_size 2G;
|
394
|
+
|
395
|
+
upstream app_server {
|
396
|
+
|
397
|
+
# for UNIX domain socket setups
|
398
|
+
|
399
|
+
server unix:/var/www/rails/tempo/tmp/sockets/.unicorn.sock fail_timeout=0;
|
400
|
+
|
401
|
+
}
|
402
|
+
|
403
|
+
server {
|
404
|
+
|
405
|
+
listen 80;
|
406
|
+
|
407
|
+
server_name 35.72.137.3;
|
408
|
+
|
409
|
+
# nginx so increasing this is generally safe...
|
410
|
+
|
411
|
+
keepalive_timeout 5;
|
412
|
+
|
413
|
+
# path for static files
|
414
|
+
|
415
|
+
root /var/www/rails/tempo/public;
|
416
|
+
|
417
|
+
# page cache loading
|
418
|
+
|
419
|
+
try_files $uri/index.html $uri.html $uri @app;
|
420
|
+
|
421
|
+
location @app {
|
422
|
+
|
423
|
+
# HTTP headers
|
424
|
+
|
425
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
426
|
+
|
427
|
+
proxy_set_header Host $http_host;
|
428
|
+
|
429
|
+
proxy_redirect off;
|
430
|
+
|
431
|
+
proxy_pass http://app_server;
|
432
|
+
|
433
|
+
}
|
434
|
+
|
435
|
+
# Rails error pages
|
436
|
+
|
437
|
+
error_page 500 502 503 504 /500.html;
|
438
|
+
|
439
|
+
location = /500.html {
|
440
|
+
|
441
|
+
root /var/www/rails/tempo/public;
|
442
|
+
|
443
|
+
}
|
444
|
+
|
445
|
+
}
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
```
|
450
|
+
|
43
451
|
|
44
452
|
|
45
453
|
|
1
エラー文の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,7 +20,21 @@
|
|
20
20
|
|
21
21
|
pingコマンドが通るか→ 通る
|
22
22
|
|
23
|
-
telnetコマンドで80ポートに接続できるか
|
23
|
+
telnetコマンドで80ポートに接続できるか
|
24
|
+
|
25
|
+
↓
|
26
|
+
|
27
|
+
```ここに言語を入力
|
28
|
+
|
29
|
+
tanaberyouni@tanaberyouninoMacBook-Air ~ % telnet 35.72.xxx.x(IPアドレス) 80
|
30
|
+
|
31
|
+
Trying 35.72.xxx.x...
|
32
|
+
|
33
|
+
telnet: connect to address 35.72.xxx.x: Connection refused
|
34
|
+
|
35
|
+
telnet: Unable to connect to remote host
|
36
|
+
|
37
|
+
```
|
24
38
|
|
25
39
|
|
26
40
|
|