質問編集履歴

8

質問の内容を大幅に変更、結論を前方に要約しました。

2019/10/17 06:27

投稿

begenner
begenner

スコア79

test CHANGED
@@ -1 +1 @@
1
- Rails + AWS でHTTPSに対応させたい(nginx 403 Forbidden エラー)
1
+ Rails + AWS + nginxエラー(nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf)
test CHANGED
@@ -16,47 +16,47 @@
16
16
 
17
17
  を参考にしました。
18
18
 
19
- しかし上記タイトルのエラーが発生したため、他のサイトを探しましたが、
19
+ しかし上記タイトルのエラーが発生したため、他のサイトを探しましたが、該当するような記事が見つからなかったため、
20
-
21
-
22
-
23
- - 設定がどれも微妙に違う
20
+
24
-
25
- - 添削の仕方がわからない(nginxに関しては初心者です)
26
-
27
-
28
-
29
- であるためnginxの設定ファイルをどのように編集すればいいか全くわかりません(m_ _m)
21
+ nginxの設定ファイルをどのように編集すればいいか全くわかりません(m_ _m)
30
22
 
31
23
  もしわかる方がいらっしゃればご教授いただきますようよろしくお願いいたします(m_ _m)
32
24
 
33
25
 
34
26
 
27
+
28
+
29
+ ## *結論(解決策)
30
+
31
+ 上記の2 で実行、反映された状態で
32
+
33
+ `/etc/nginx/conf.d/webapp.conf` 内に
34
+
35
+ `include /etc/letsencrypt/options-ssl-nginx.conf;`
36
+
37
+ という行があり(追加され)、
38
+
39
+
40
+
41
+ `/etc/nginx/conf.d/webapp.conf`の`ssl_protocols TLSv1 TLSv1.1 TLSv1.2;`
42
+
43
+
44
+
45
+ `/etc/letsencrypt/options-ssl-nginx.conf`の `ssl_protocols TLSv1.2;`
46
+
35
- ### デプロイ、HTTPS対応させるために参考にしてサイト
47
+ で重複が発生してい `warning`が発生していまし
48
+
49
+
50
+
36
-
51
+ `/etc/nginx/conf.d/webapp.conf`の`ssl_protocols TLSv1 TLSv1.1 TLSv1.2;`
52
+
53
+ の行をコメントアウト(もしくは)削除することで`warning`は発生しなくなりました。
54
+
37
- 1. アプリデプロイ
55
+ 経緯は回答方にありす。
38
-
39
- [(デプロイ編②)世界一丁寧なAWS解説。EC2を利用して、RailsアプリをAWSにあげるまで - Qiita](https://qiita.com/naoki_mochizuki/items/5a1757d222806cbe0cd1)
56
+
40
-
41
-
42
-
43
- 2. HTTPS対応のために参考にした記事(2つ)
57
+
44
-
45
- [[Rails][Nginx][AWS] Let's EncryptをEC2上のRailsに入れてHttpsにする - Qiita](https://qiita.com/Masahiro_T/items/9b81b31b3c21bd03fc09)
58
+
46
-
47
- [Amazon Linux2とLet's EncryptでSSL対応サーバを0から爆速構築 - Qiita](https://qiita.com/MysteriousMonky/items/4d3d857c0e68d4bfff39)
59
+ [yu_1985](https://teratail.com/users/yu_1985#reply)さん、本当にありがとうございました!!
48
-
49
-
50
-
51
- 3. nginx設定ファイルの参考にしたサイト
52
-
53
- [RailsアプリをAWS EC2で公開する超簡単な手順 【独自ドメイン/HTTPS対応】 - ひろこま Hack Log](https://www.mahirokazuko.com/entry/2018/09/11/112010)
54
-
55
-
56
-
57
- 4. nginxとunicornの設定について(これを利用して編集はしていません)
58
-
59
- [【Ruby on Rails】Nginxとunicornを使ってHTTPS(SSL)対応する方法 | Y-hilite](https://y-hilite.com/2908/)
60
60
 
61
61
 
62
62
 
@@ -106,59 +106,259 @@
106
106
 
107
107
  ### エラー内容
108
108
 
109
- 1. nginx を再起動してブラウザにアクセスすると`nginx 403 Forbidden`が発生
110
-
111
- 2. 下記の設定ファイルを保存し`sudo nginx -t`を実行した時`[warn] duplicate value "TLSv1.2"`と警告が出る
109
+ - 下記の設定ファイルを保存し`sudo nginx -t`を実行した時`[warn] duplicate value "TLSv1.2"`と警告が出る
112
110
 
113
111
  (ファイルに同じ文字列は存在しない)
114
112
 
113
+
114
+
115
+
116
+
117
+
118
+
115
- 3. `/var/www/rails/webapp/log/nginx.error.log`を確認すると下記のエラーが表示されている
119
+ ### nginxのシンタックスチェック、再起動後のステータス確認結果
116
120
 
117
121
  ```bash
118
122
 
123
+ [username@ip-xxx-xxx-xxx-xxx ~]$ sudo nginx -t
124
+
125
+ # nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
126
+
127
+ # nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
128
+
129
+ # nginx: configuration file /etc/nginx/nginx.conf test is successful
130
+
131
+
132
+
133
+
134
+
135
+ [username@ip-xxx-xxx-xxx-xxx ~]$ sudo service nginx restart
136
+
137
+ # Redirecting to /bin/systemctl restart nginx.service
138
+
139
+
140
+
141
+
142
+
143
+ [username@ip-xxx-xxx-xxx-xxx ~]$ sudo service nginx status
144
+
145
+ # Redirecting to /bin/systemctl status nginx.service
146
+
147
+ # ● nginx.service - The nginx HTTP and reverse proxy server
148
+
149
+ # Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
150
+
151
+ # Active: active (running) since 火 2019-10-15 23:08:09 JST; 4s ago
152
+
153
+ # Process: 11316 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
154
+
155
+ # Process: 11313 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
156
+
157
+ # Process: 11311 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
158
+
159
+ # Main PID: 11319 (nginx)
160
+
161
+ # CGroup: /system.slice/nginx.service
162
+
163
+ # ├─11319 nginx: master process /usr/sbin/nginx
164
+
165
+ # └─11320 nginx: worker process
166
+
167
+ #
168
+
169
+ # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy server...
170
+
119
- [error] 28121#0: *1 directory index of "/var/www/rails/webapp/public/" is forbidden, client: 211.1.206.206, server: domainName, request: "GET / HTTP/1.1", host: "domainName"
171
+ # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
172
+
173
+ # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
174
+
175
+ # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: configuration file /etc/nginx/nginx.conf test is successful
176
+
177
+ # 10月 15 23:08:09 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11316]: nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
178
+
179
+ # 10月 15 23:08:09 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal systemd[1]: Started The nginx HTTP and reverse proxy server.
120
180
 
121
181
  ```
122
182
 
123
183
 
124
184
 
125
- - /etc/nginx/ 配下の構成は下記のようになっています
185
+ ### nginxの設定ファイル1(/etc/nginx/nginx.conf)
126
186
 
127
187
  ```bash
128
188
 
129
- conf.d # ディレクトリ
130
-
131
- default.d # ディレクトリ
132
-
133
- fastcgi.conf
134
-
135
- fastcgi.conf.default
136
-
137
- fastcgi_params
138
-
139
- fastcgi_params.default
140
-
141
- koi-utf
142
-
143
- koi-win
144
-
145
- mime.types
146
-
147
- mime.types.default
148
-
149
- nginx.conf
150
-
151
- nginx.conf.default
152
-
153
- scgi_params
154
-
155
- scgi_params.default
156
-
157
- uwsgi_params
158
-
159
- uwsgi_params.default
160
-
161
- win-utf
189
+ # For more information on configuration, see:
190
+
191
+ # * Official English Documentation: http://nginx.org/en/docs/
192
+
193
+ # * Official Russian Documentation: http://nginx.org/ru/docs/
194
+
195
+
196
+
197
+ user nginx;
198
+
199
+ worker_processes auto;
200
+
201
+ error_log /var/log/nginx/error.log;
202
+
203
+ pid /run/nginx.pid;
204
+
205
+
206
+
207
+ # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
208
+
209
+ include /usr/share/nginx/modules/*.conf;
210
+
211
+
212
+
213
+ events {
214
+
215
+ worker_connections 1024;
216
+
217
+ }
218
+
219
+
220
+
221
+ http {
222
+
223
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
224
+
225
+ '$status $body_bytes_sent "$http_referer" '
226
+
227
+ '"$http_user_agent" "$http_x_forwarded_for"';
228
+
229
+
230
+
231
+ access_log /var/log/nginx/access.log main;
232
+
233
+
234
+
235
+ sendfile on;
236
+
237
+ tcp_nopush on;
238
+
239
+ tcp_nodelay on;
240
+
241
+ keepalive_timeout 65;
242
+
243
+ types_hash_max_size 2048;
244
+
245
+
246
+
247
+ include /etc/nginx/mime.types;
248
+
249
+ default_type application/octet-stream;
250
+
251
+
252
+
253
+ # Load modular configuration files from the /etc/nginx/conf.d directory.
254
+
255
+ # See http://nginx.org/en/docs/ngx_core_module.html#include
256
+
257
+ # for more information.
258
+
259
+ include /etc/nginx/conf.d/*.conf;
260
+
261
+
262
+
263
+ server {
264
+
265
+ listen 80 default_server;
266
+
267
+ listen [::]:80 default_server;
268
+
269
+ server_name _;
270
+
271
+ root /usr/share/nginx/html;
272
+
273
+
274
+
275
+ # Load configuration files for the default server block.
276
+
277
+ include /etc/nginx/default.d/*.conf;
278
+
279
+
280
+
281
+ location / {
282
+
283
+ }
284
+
285
+
286
+
287
+ error_page 404 /404.html;
288
+
289
+ location = /40x.html {
290
+
291
+ }
292
+
293
+
294
+
295
+ error_page 500 502 503 504 /50x.html;
296
+
297
+ location = /50x.html {
298
+
299
+ }
300
+
301
+ }
302
+
303
+
304
+
305
+ # Settings for a TLS enabled server.
306
+
307
+ #
308
+
309
+ # server {
310
+
311
+ # listen 443 ssl http2 default_server;
312
+
313
+ # listen [::]:443 ssl http2 default_server;
314
+
315
+ # server_name _;
316
+
317
+ # root /usr/share/nginx/html;
318
+
319
+ #
320
+
321
+ # ssl_certificate "/etc/pki/nginx/server.crt";
322
+
323
+ # ssl_certificate_key "/etc/pki/nginx/private/server.key";
324
+
325
+ # ssl_session_cache shared:SSL:1m;
326
+
327
+ # ssl_session_timeout 10m;
328
+
329
+ # ssl_ciphers HIGH:!aNULL:!MD5;
330
+
331
+ # ssl_prefer_server_ciphers on;
332
+
333
+ #
334
+
335
+ # # Load configuration files for the default server block.
336
+
337
+ # include /etc/nginx/default.d/*.conf;
338
+
339
+ #
340
+
341
+ # location / {
342
+
343
+ # }
344
+
345
+ #
346
+
347
+ # error_page 404 /404.html;
348
+
349
+ # location = /40x.html {
350
+
351
+ # }
352
+
353
+ #
354
+
355
+ # error_page 500 502 503 504 /50x.html;
356
+
357
+ # location = /50x.html {
358
+
359
+ # }
360
+
361
+ # }
162
362
 
163
363
  ```
164
364
 
@@ -168,440 +368,138 @@
168
368
 
169
369
 
170
370
 
171
-
172
-
173
- ### nginxのシンタックスチェック、再起動後のステータス確認結果
371
+ ### nginxの設定ファイル2(/etc/nginx/conf.d/webapp.conf)
174
372
 
175
373
  ```bash
176
374
 
177
- [username@ip-xxx-xxx-xxx-xxx ~]$ sudo nginx -t
178
-
179
- # nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
180
-
181
- # nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
182
-
183
- # nginx: configuration file /etc/nginx/nginx.conf test is successful
184
-
185
-
186
-
187
-
188
-
189
- [username@ip-xxx-xxx-xxx-xxx ~]$ sudo service nginx restart
190
-
191
- # Redirecting to /bin/systemctl restart nginx.service
192
-
193
-
194
-
195
-
196
-
197
- [username@ip-xxx-xxx-xxx-xxx ~]$ sudo service nginx status
198
-
199
- # Redirecting to /bin/systemctl status nginx.service
200
-
201
- # nginx.service - The nginx HTTP and reverse proxy server
202
-
203
- # Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
204
-
205
- # Active: active (running) since 火 2019-10-15 23:08:09 JST; 4s ago
206
-
207
- # Process: 11316 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
208
-
209
- # Process: 11313 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
210
-
211
- # Process: 11311 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
212
-
213
- # Main PID: 11319 (nginx)
214
-
215
- # CGroup: /system.slice/nginx.service
216
-
217
- # ├─11319 nginx: master process /usr/sbin/nginx
218
-
219
- # └─11320 nginx: worker process
220
-
221
- #
222
-
223
- # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy server...
224
-
225
- # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
226
-
227
- # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
228
-
229
- # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: configuration file /etc/nginx/nginx.conf test is successful
230
-
231
- # 10月 15 23:08:09 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11316]: nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
232
-
233
- # 10月 15 23:08:09 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal systemd[1]: Started The nginx HTTP and reverse proxy server.
375
+ ```bash
376
+
377
+ # /etc/nginx/conf.d/webapp.conf
378
+
379
+
380
+
381
+ # log directory
382
+
383
+ error_log /var/www/rails/webapp/log/nginx.error.log;
384
+
385
+ access_log /var/www/rails/webapp/log/nginx.access.log;
386
+
387
+
388
+
389
+ # max body size
390
+
391
+ #client_max_body_size 2G;
392
+
393
+
394
+
395
+ upstream app_server {
396
+
397
+ # for UNIX domain socket setups
398
+
399
+ server unix:/var/www/rails/webapp/tmp/sockets/.unicorn.sock fail_timeout=0;
400
+
401
+ }
402
+
403
+
404
+
405
+ server {
406
+
407
+ listen 443 ssl;
408
+
409
+
410
+
411
+ server_name domainName;
412
+
413
+
414
+
415
+ # 接続制限の設定(nginx so increasing this is generally safe..)
416
+
417
+ # 接続を保つ秒数
418
+
419
+ keepalive_timeout 5;
420
+
421
+
422
+
423
+ # クライアントからのリクエストボディは2Gまで許容
424
+
425
+ client_max_body_size 2G;
426
+
427
+
428
+
429
+ # path for static files
430
+
431
+ root /var/www/rails/webapp/public;
432
+
433
+
434
+
435
+ # page cache loading
436
+
437
+ try_files $uri/index.html $uri.html $uri @app;
438
+
439
+
440
+
441
+ location @app {
442
+
443
+ proxy_set_header X-Real-IP $remote_addr;
444
+
445
+
446
+
447
+ proxy_set_header X-Forwarded-Proto $scheme;
448
+
449
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
450
+
451
+ proxy_set_header Host $http_host;
452
+
453
+ }
454
+
455
+
456
+
457
+ # Railsエラーページ
458
+
459
+ error_page 500 502 503 504 /500.html;
460
+
461
+
462
+
463
+ location = /500.html {
464
+
465
+ root /var/www/rails/webapp/public;
466
+
467
+ }
468
+
469
+
470
+
471
+
472
+
473
+
474
+
475
+
476
+
477
+ # listen 443 ssl; # managed by Certbot
478
+
479
+ ssl_certificate /etc/letsencrypt/live/domainName/fullchain.pem; # managed by Certbot
480
+
481
+ ssl_certificate_key /etc/letsencrypt/live/domainName/privkey.pem; # managed by Certbot
482
+
483
+ include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
484
+
485
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
486
+
487
+
488
+
489
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
490
+
491
+ }
492
+
493
+
494
+
495
+ server {
496
+
497
+ listen 80;
498
+
499
+ server_name domainName;
500
+
501
+ return 301 https://$host$request_uri;
502
+
503
+ }
234
504
 
235
505
  ```
236
-
237
-
238
-
239
- ### nginxの設定ファイル1(/etc/nginx/nginx.conf)
240
-
241
- ```bash
242
-
243
- # For more information on configuration, see:
244
-
245
- # * Official English Documentation: http://nginx.org/en/docs/
246
-
247
- # * Official Russian Documentation: http://nginx.org/ru/docs/
248
-
249
-
250
-
251
- user nginx;
252
-
253
- worker_processes auto;
254
-
255
- error_log /var/log/nginx/error.log;
256
-
257
- pid /run/nginx.pid;
258
-
259
-
260
-
261
- # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
262
-
263
- include /usr/share/nginx/modules/*.conf;
264
-
265
-
266
-
267
- events {
268
-
269
- worker_connections 1024;
270
-
271
- }
272
-
273
-
274
-
275
- http {
276
-
277
- log_format main '$remote_addr - $remote_user [$time_local] "$request" '
278
-
279
- '$status $body_bytes_sent "$http_referer" '
280
-
281
- '"$http_user_agent" "$http_x_forwarded_for"';
282
-
283
-
284
-
285
- access_log /var/log/nginx/access.log main;
286
-
287
-
288
-
289
- sendfile on;
290
-
291
- tcp_nopush on;
292
-
293
- tcp_nodelay on;
294
-
295
- keepalive_timeout 65;
296
-
297
- types_hash_max_size 2048;
298
-
299
-
300
-
301
- include /etc/nginx/mime.types;
302
-
303
- default_type application/octet-stream;
304
-
305
-
306
-
307
- # Load modular configuration files from the /etc/nginx/conf.d directory.
308
-
309
- # See http://nginx.org/en/docs/ngx_core_module.html#include
310
-
311
- # for more information.
312
-
313
- include /etc/nginx/conf.d/*.conf;
314
-
315
-
316
-
317
- server {
318
-
319
- listen 80 default_server;
320
-
321
- listen [::]:80 default_server;
322
-
323
- server_name _;
324
-
325
- root /usr/share/nginx/html;
326
-
327
-
328
-
329
- # Load configuration files for the default server block.
330
-
331
- include /etc/nginx/default.d/*.conf;
332
-
333
-
334
-
335
- location / {
336
-
337
- }
338
-
339
-
340
-
341
- error_page 404 /404.html;
342
-
343
- location = /40x.html {
344
-
345
- }
346
-
347
-
348
-
349
- error_page 500 502 503 504 /50x.html;
350
-
351
- location = /50x.html {
352
-
353
- }
354
-
355
- }
356
-
357
-
358
-
359
- # Settings for a TLS enabled server.
360
-
361
- #
362
-
363
- # server {
364
-
365
- # listen 443 ssl http2 default_server;
366
-
367
- # listen [::]:443 ssl http2 default_server;
368
-
369
- # server_name _;
370
-
371
- # root /usr/share/nginx/html;
372
-
373
- #
374
-
375
- # ssl_certificate "/etc/pki/nginx/server.crt";
376
-
377
- # ssl_certificate_key "/etc/pki/nginx/private/server.key";
378
-
379
- # ssl_session_cache shared:SSL:1m;
380
-
381
- # ssl_session_timeout 10m;
382
-
383
- # ssl_ciphers HIGH:!aNULL:!MD5;
384
-
385
- # ssl_prefer_server_ciphers on;
386
-
387
- #
388
-
389
- # # Load configuration files for the default server block.
390
-
391
- # include /etc/nginx/default.d/*.conf;
392
-
393
- #
394
-
395
- # location / {
396
-
397
- # }
398
-
399
- #
400
-
401
- # error_page 404 /404.html;
402
-
403
- # location = /40x.html {
404
-
405
- # }
406
-
407
- #
408
-
409
- # error_page 500 502 503 504 /50x.html;
410
-
411
- # location = /50x.html {
412
-
413
- # }
414
-
415
- # }
416
-
417
- ```
418
-
419
-
420
-
421
-
422
-
423
-
424
-
425
- ### nginxの設定ファイル2(/etc/nginx/conf.d/webapp.conf)
426
-
427
- ```bash
428
-
429
- ```bash
430
-
431
- # /etc/nginx/conf.d/webapp.conf
432
-
433
-
434
-
435
- # log directory
436
-
437
- error_log /var/www/rails/webapp/log/nginx.error.log;
438
-
439
- access_log /var/www/rails/webapp/log/nginx.access.log;
440
-
441
-
442
-
443
- # max body size
444
-
445
- #client_max_body_size 2G;
446
-
447
-
448
-
449
- upstream app_server {
450
-
451
- # for UNIX domain socket setups
452
-
453
- server unix:/var/www/rails/webapp/tmp/sockets/.unicorn.sock fail_timeout=0;
454
-
455
- }
456
-
457
-
458
-
459
- server {
460
-
461
- listen 443 ssl;
462
-
463
-
464
-
465
- server_name domainName;
466
-
467
-
468
-
469
- # 接続制限の設定(nginx so increasing this is generally safe..)
470
-
471
- # 接続を保つ秒数
472
-
473
- keepalive_timeout 5;
474
-
475
-
476
-
477
- # クライアントからのリクエストボディは2Gまで許容
478
-
479
- client_max_body_size 2G;
480
-
481
-
482
-
483
- # path for static files
484
-
485
- root /var/www/rails/webapp/public;
486
-
487
-
488
-
489
- # page cache loading
490
-
491
- try_files $uri/index.html $uri.html $uri @app;
492
-
493
-
494
-
495
- location @app {
496
-
497
- proxy_set_header X-Real-IP $remote_addr;
498
-
499
-
500
-
501
- proxy_set_header X-Forwarded-Proto $scheme;
502
-
503
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
504
-
505
- proxy_set_header Host $http_host;
506
-
507
- }
508
-
509
-
510
-
511
- # Railsエラーページ
512
-
513
- error_page 500 502 503 504 /500.html;
514
-
515
-
516
-
517
- location = /500.html {
518
-
519
- root /var/www/rails/webapp/public;
520
-
521
- }
522
-
523
-
524
-
525
-
526
-
527
-
528
-
529
-
530
-
531
- # listen 443 ssl; # managed by Certbot
532
-
533
- ssl_certificate /etc/letsencrypt/live/domainName/fullchain.pem; # managed by Certbot
534
-
535
- ssl_certificate_key /etc/letsencrypt/live/domainName/privkey.pem; # managed by Certbot
536
-
537
- include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
538
-
539
- ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
540
-
541
-
542
-
543
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
544
-
545
- }
546
-
547
-
548
-
549
- server {
550
-
551
- listen 80;
552
-
553
- server_name domainName;
554
-
555
- return 301 https://$host$request_uri;
556
-
557
- }
558
-
559
- ```
560
-
561
-
562
-
563
- ### 追記1(権限関係の確認)
564
-
565
- ```bash
566
-
567
- [username@ip-xxx-xxx-xxx-xxx ~]$ cd /;ls -la
568
-
569
- # drwx-----x 20 username username 280 10月 4 13:44 var
570
-
571
-
572
-
573
- [username@ip-xxx-xxx-xxx-xxx ~]$ cd /var/;ls -la
574
-
575
- # drwx-----x 4 username username 38 10月 14 17:45 www
576
-
577
-
578
-
579
- [username@ip-xxx-xxx-xxx-xxx ~]$ cd /www/;ls -la
580
-
581
- # drwx-----x 3 username username 43 10月 4 14:12 rails
582
-
583
-
584
-
585
- [username@ip-xxx-xxx-xxx-xxx ~]$ cd /rails/;ls -la
586
-
587
- # drwxrwxrwx 15 username username 302 10月 14 14:03 webapp
588
-
589
-
590
-
591
- [username@ip-xxx-xxx-xxx-xxx ~]$ cd /webapp/;ls -la
592
-
593
- # drwxrwxrwx 15 username username 302 10月 14 14:03 public
594
-
595
- ```
596
-
597
-
598
-
599
-
600
-
601
-
602
-
603
- ### 追記2
604
-
605
- httpsでURLにアクセス -> httpでURLにアクセス すると下記の状態が表示されます
606
-
607
- ![イメージ説明](843dc5b59f02e91181b703dfec06f82a.png)

7

httpでURLにアクセスした場合の画像を追加しました

2019/10/17 06:27

投稿

begenner
begenner

スコア79

test CHANGED
File without changes
test CHANGED
@@ -560,7 +560,7 @@
560
560
 
561
561
 
562
562
 
563
- ### 追記(権限関係の確認)
563
+ ### 追記1(権限関係の確認)
564
564
 
565
565
  ```bash
566
566
 
@@ -593,3 +593,15 @@
593
593
  # drwxrwxrwx 15 username username 302 10月 14 14:03 public
594
594
 
595
595
  ```
596
+
597
+
598
+
599
+
600
+
601
+
602
+
603
+ ### 追記2
604
+
605
+ httpsでURLにアクセス -> httpでURLにアクセス すると下記の状態が表示されます
606
+
607
+ ![イメージ説明](843dc5b59f02e91181b703dfec06f82a.png)

6

webapp 関連のファイル権限を追記しました

2019/10/17 02:58

投稿

begenner
begenner

スコア79

test CHANGED
File without changes
test CHANGED
@@ -557,3 +557,39 @@
557
557
  }
558
558
 
559
559
  ```
560
+
561
+
562
+
563
+ ### 追記(権限関係の確認)
564
+
565
+ ```bash
566
+
567
+ [username@ip-xxx-xxx-xxx-xxx ~]$ cd /;ls -la
568
+
569
+ # drwx-----x 20 username username 280 10月 4 13:44 var
570
+
571
+
572
+
573
+ [username@ip-xxx-xxx-xxx-xxx ~]$ cd /var/;ls -la
574
+
575
+ # drwx-----x 4 username username 38 10月 14 17:45 www
576
+
577
+
578
+
579
+ [username@ip-xxx-xxx-xxx-xxx ~]$ cd /www/;ls -la
580
+
581
+ # drwx-----x 3 username username 43 10月 4 14:12 rails
582
+
583
+
584
+
585
+ [username@ip-xxx-xxx-xxx-xxx ~]$ cd /rails/;ls -la
586
+
587
+ # drwxrwxrwx 15 username username 302 10月 14 14:03 webapp
588
+
589
+
590
+
591
+ [username@ip-xxx-xxx-xxx-xxx ~]$ cd /webapp/;ls -la
592
+
593
+ # drwxrwxrwx 15 username username 302 10月 14 14:03 public
594
+
595
+ ```

5

エラー内容に log/nginx.error.log の内容を追記しました

2019/10/16 22:15

投稿

begenner
begenner

スコア79

test CHANGED
File without changes
test CHANGED
@@ -112,6 +112,14 @@
112
112
 
113
113
  (ファイルに同じ文字列は存在しない)
114
114
 
115
+ 3. `/var/www/rails/webapp/log/nginx.error.log`を確認すると下記のエラーが表示されている
116
+
117
+ ```bash
118
+
119
+ [error] 28121#0: *1 directory index of "/var/www/rails/webapp/public/" is forbidden, client: 211.1.206.206, server: domainName, request: "GET / HTTP/1.1", host: "domainName"
120
+
121
+ ```
122
+
115
123
 
116
124
 
117
125
  - /etc/nginx/ 配下の構成は下記のようになっています

4

ファイル内容の順番を入れ替えました

2019/10/16 14:10

投稿

begenner
begenner

スコア79

test CHANGED
File without changes
test CHANGED
@@ -114,10 +114,6 @@
114
114
 
115
115
 
116
116
 
117
-
118
-
119
- ### 追記1
120
-
121
117
  - /etc/nginx/ 配下の構成は下記のようになっています
122
118
 
123
119
  ```bash
@@ -160,10 +156,82 @@
160
156
 
161
157
 
162
158
 
159
+
160
+
161
+
162
+
163
+
164
+
163
- - ファイル`/etc/nginx/nginx.conf`は下記設定になっています
165
+ ### nginxのシンタックスチェック、再起動後のステータス確認結果
164
166
 
165
167
  ```bash
166
168
 
169
+ [username@ip-xxx-xxx-xxx-xxx ~]$ sudo nginx -t
170
+
171
+ # nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
172
+
173
+ # nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
174
+
175
+ # nginx: configuration file /etc/nginx/nginx.conf test is successful
176
+
177
+
178
+
179
+
180
+
181
+ [username@ip-xxx-xxx-xxx-xxx ~]$ sudo service nginx restart
182
+
183
+ # Redirecting to /bin/systemctl restart nginx.service
184
+
185
+
186
+
187
+
188
+
189
+ [username@ip-xxx-xxx-xxx-xxx ~]$ sudo service nginx status
190
+
191
+ # Redirecting to /bin/systemctl status nginx.service
192
+
193
+ # ● nginx.service - The nginx HTTP and reverse proxy server
194
+
195
+ # Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
196
+
197
+ # Active: active (running) since 火 2019-10-15 23:08:09 JST; 4s ago
198
+
199
+ # Process: 11316 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
200
+
201
+ # Process: 11313 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
202
+
203
+ # Process: 11311 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
204
+
205
+ # Main PID: 11319 (nginx)
206
+
207
+ # CGroup: /system.slice/nginx.service
208
+
209
+ # ├─11319 nginx: master process /usr/sbin/nginx
210
+
211
+ # └─11320 nginx: worker process
212
+
213
+ #
214
+
215
+ # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy server...
216
+
217
+ # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
218
+
219
+ # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
220
+
221
+ # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: configuration file /etc/nginx/nginx.conf test is successful
222
+
223
+ # 10月 15 23:08:09 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11316]: nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
224
+
225
+ # 10月 15 23:08:09 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal systemd[1]: Started The nginx HTTP and reverse proxy server.
226
+
227
+ ```
228
+
229
+
230
+
231
+ ### nginxの設定ファイル1(/etc/nginx/nginx.conf)
232
+
233
+ ```bash
234
+
167
235
  # For more information on configuration, see:
168
236
 
169
237
  # * Official English Documentation: http://nginx.org/en/docs/
@@ -344,204 +412,140 @@
344
412
 
345
413
 
346
414
 
415
+
416
+
347
- ### nginxのシンタックスチェック、再起動後のステータス確認結果
417
+ ### nginxの設定ファイル2(/etc/nginx/conf.d/webapp.conf)
348
418
 
349
419
  ```bash
350
420
 
351
- [username@ip-xxx-xxx-xxx-xxx ~]$ sudo nginx -t
352
-
353
- # nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
354
-
355
- # nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
356
-
357
- # nginx: configuration file /etc/nginx/nginx.conf test is successful
358
-
359
-
360
-
361
-
362
-
363
- [username@ip-xxx-xxx-xxx-xxx ~]$ sudo service nginx restart
364
-
365
- # Redirecting to /bin/systemctl restart nginx.service
366
-
367
-
368
-
369
-
370
-
371
- [username@ip-xxx-xxx-xxx-xxx ~]$ sudo service nginx status
372
-
373
- # Redirecting to /bin/systemctl status nginx.service
374
-
375
- # nginx.service - The nginx HTTP and reverse proxy server
376
-
377
- # Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
378
-
379
- # Active: active (running) since 火 2019-10-15 23:08:09 JST; 4s ago
380
-
381
- # Process: 11316 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
382
-
383
- # Process: 11313 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
384
-
385
- # Process: 11311 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
386
-
387
- # Main PID: 11319 (nginx)
388
-
389
- # CGroup: /system.slice/nginx.service
390
-
391
- # ├─11319 nginx: master process /usr/sbin/nginx
392
-
393
- # └─11320 nginx: worker process
394
-
395
- #
396
-
397
- # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy server...
398
-
399
- # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
400
-
401
- # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
402
-
403
- # 10月 15 23:08:08 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11313]: nginx: configuration file /etc/nginx/nginx.conf test is successful
404
-
405
- # 10月 15 23:08:09 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal nginx[11316]: nginx: [warn] duplicate value "TLSv1.2" in /etc/nginx/conf.d/webapp.conf:66
406
-
407
- # 10月 15 23:08:09 ip-xxx-xxx-xxx-xxx.ap-northeast-1.compute.internal systemd[1]: Started The nginx HTTP and reverse proxy server.
421
+ ```bash
422
+
423
+ # /etc/nginx/conf.d/webapp.conf
424
+
425
+
426
+
427
+ # log directory
428
+
429
+ error_log /var/www/rails/webapp/log/nginx.error.log;
430
+
431
+ access_log /var/www/rails/webapp/log/nginx.access.log;
432
+
433
+
434
+
435
+ # max body size
436
+
437
+ #client_max_body_size 2G;
438
+
439
+
440
+
441
+ upstream app_server {
442
+
443
+ # for UNIX domain socket setups
444
+
445
+ server unix:/var/www/rails/webapp/tmp/sockets/.unicorn.sock fail_timeout=0;
446
+
447
+ }
448
+
449
+
450
+
451
+ server {
452
+
453
+ listen 443 ssl;
454
+
455
+
456
+
457
+ server_name domainName;
458
+
459
+
460
+
461
+ # 接続制限の設定(nginx so increasing this is generally safe..)
462
+
463
+ # 接続を保つ秒数
464
+
465
+ keepalive_timeout 5;
466
+
467
+
468
+
469
+ # クライアントからのリクエストボディは2Gまで許容
470
+
471
+ client_max_body_size 2G;
472
+
473
+
474
+
475
+ # path for static files
476
+
477
+ root /var/www/rails/webapp/public;
478
+
479
+
480
+
481
+ # page cache loading
482
+
483
+ try_files $uri/index.html $uri.html $uri @app;
484
+
485
+
486
+
487
+ location @app {
488
+
489
+ proxy_set_header X-Real-IP $remote_addr;
490
+
491
+
492
+
493
+ proxy_set_header X-Forwarded-Proto $scheme;
494
+
495
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
496
+
497
+ proxy_set_header Host $http_host;
498
+
499
+ }
500
+
501
+
502
+
503
+ # Railsエラーページ
504
+
505
+ error_page 500 502 503 504 /500.html;
506
+
507
+
508
+
509
+ location = /500.html {
510
+
511
+ root /var/www/rails/webapp/public;
512
+
513
+ }
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+
522
+
523
+ # listen 443 ssl; # managed by Certbot
524
+
525
+ ssl_certificate /etc/letsencrypt/live/domainName/fullchain.pem; # managed by Certbot
526
+
527
+ ssl_certificate_key /etc/letsencrypt/live/domainName/privkey.pem; # managed by Certbot
528
+
529
+ include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
530
+
531
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
532
+
533
+
534
+
535
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
536
+
537
+ }
538
+
539
+
540
+
541
+ server {
542
+
543
+ listen 80;
544
+
545
+ server_name domainName;
546
+
547
+ return 301 https://$host$request_uri;
548
+
549
+ }
408
550
 
409
551
  ```
410
-
411
-
412
-
413
- ### nginxの設定ファイル(/etc/nginx/conf.d/webapp.conf)
414
-
415
- ```bash
416
-
417
- ```bash
418
-
419
- # /etc/nginx/conf.d/webapp.conf
420
-
421
-
422
-
423
- # log directory
424
-
425
- error_log /var/www/rails/webapp/log/nginx.error.log;
426
-
427
- access_log /var/www/rails/webapp/log/nginx.access.log;
428
-
429
-
430
-
431
- # max body size
432
-
433
- #client_max_body_size 2G;
434
-
435
-
436
-
437
- upstream app_server {
438
-
439
- # for UNIX domain socket setups
440
-
441
- server unix:/var/www/rails/webapp/tmp/sockets/.unicorn.sock fail_timeout=0;
442
-
443
- }
444
-
445
-
446
-
447
- server {
448
-
449
- listen 443 ssl;
450
-
451
-
452
-
453
- server_name domainName;
454
-
455
-
456
-
457
- # 接続制限の設定(nginx so increasing this is generally safe..)
458
-
459
- # 接続を保つ秒数
460
-
461
- keepalive_timeout 5;
462
-
463
-
464
-
465
- # クライアントからのリクエストボディは2Gまで許容
466
-
467
- client_max_body_size 2G;
468
-
469
-
470
-
471
- # path for static files
472
-
473
- root /var/www/rails/webapp/public;
474
-
475
-
476
-
477
- # page cache loading
478
-
479
- try_files $uri/index.html $uri.html $uri @app;
480
-
481
-
482
-
483
- location @app {
484
-
485
- proxy_set_header X-Real-IP $remote_addr;
486
-
487
-
488
-
489
- proxy_set_header X-Forwarded-Proto $scheme;
490
-
491
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
492
-
493
- proxy_set_header Host $http_host;
494
-
495
- }
496
-
497
-
498
-
499
- # Railsエラーページ
500
-
501
- error_page 500 502 503 504 /500.html;
502
-
503
-
504
-
505
- location = /500.html {
506
-
507
- root /var/www/rails/webapp/public;
508
-
509
- }
510
-
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
-
519
- # listen 443 ssl; # managed by Certbot
520
-
521
- ssl_certificate /etc/letsencrypt/live/domainName/fullchain.pem; # managed by Certbot
522
-
523
- ssl_certificate_key /etc/letsencrypt/live/domainName/privkey.pem; # managed by Certbot
524
-
525
- include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
526
-
527
- ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
528
-
529
-
530
-
531
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
532
-
533
- }
534
-
535
-
536
-
537
- server {
538
-
539
- listen 80;
540
-
541
- server_name domainName;
542
-
543
- return 301 https://$host$request_uri;
544
-
545
- }
546
-
547
- ```

3

追記依頼の内容を追記しました

2019/10/16 13:35

投稿

begenner
begenner

スコア79

test CHANGED
File without changes
test CHANGED
@@ -114,6 +114,236 @@
114
114
 
115
115
 
116
116
 
117
+
118
+
119
+ ### 追記1
120
+
121
+ - /etc/nginx/ 配下の構成は下記のようになっています
122
+
123
+ ```bash
124
+
125
+ conf.d # ディレクトリ
126
+
127
+ default.d # ディレクトリ
128
+
129
+ fastcgi.conf
130
+
131
+ fastcgi.conf.default
132
+
133
+ fastcgi_params
134
+
135
+ fastcgi_params.default
136
+
137
+ koi-utf
138
+
139
+ koi-win
140
+
141
+ mime.types
142
+
143
+ mime.types.default
144
+
145
+ nginx.conf
146
+
147
+ nginx.conf.default
148
+
149
+ scgi_params
150
+
151
+ scgi_params.default
152
+
153
+ uwsgi_params
154
+
155
+ uwsgi_params.default
156
+
157
+ win-utf
158
+
159
+ ```
160
+
161
+
162
+
163
+ - ファイル`/etc/nginx/nginx.conf`は下記の設定になっています
164
+
165
+ ```bash
166
+
167
+ # For more information on configuration, see:
168
+
169
+ # * Official English Documentation: http://nginx.org/en/docs/
170
+
171
+ # * Official Russian Documentation: http://nginx.org/ru/docs/
172
+
173
+
174
+
175
+ user nginx;
176
+
177
+ worker_processes auto;
178
+
179
+ error_log /var/log/nginx/error.log;
180
+
181
+ pid /run/nginx.pid;
182
+
183
+
184
+
185
+ # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
186
+
187
+ include /usr/share/nginx/modules/*.conf;
188
+
189
+
190
+
191
+ events {
192
+
193
+ worker_connections 1024;
194
+
195
+ }
196
+
197
+
198
+
199
+ http {
200
+
201
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
202
+
203
+ '$status $body_bytes_sent "$http_referer" '
204
+
205
+ '"$http_user_agent" "$http_x_forwarded_for"';
206
+
207
+
208
+
209
+ access_log /var/log/nginx/access.log main;
210
+
211
+
212
+
213
+ sendfile on;
214
+
215
+ tcp_nopush on;
216
+
217
+ tcp_nodelay on;
218
+
219
+ keepalive_timeout 65;
220
+
221
+ types_hash_max_size 2048;
222
+
223
+
224
+
225
+ include /etc/nginx/mime.types;
226
+
227
+ default_type application/octet-stream;
228
+
229
+
230
+
231
+ # Load modular configuration files from the /etc/nginx/conf.d directory.
232
+
233
+ # See http://nginx.org/en/docs/ngx_core_module.html#include
234
+
235
+ # for more information.
236
+
237
+ include /etc/nginx/conf.d/*.conf;
238
+
239
+
240
+
241
+ server {
242
+
243
+ listen 80 default_server;
244
+
245
+ listen [::]:80 default_server;
246
+
247
+ server_name _;
248
+
249
+ root /usr/share/nginx/html;
250
+
251
+
252
+
253
+ # Load configuration files for the default server block.
254
+
255
+ include /etc/nginx/default.d/*.conf;
256
+
257
+
258
+
259
+ location / {
260
+
261
+ }
262
+
263
+
264
+
265
+ error_page 404 /404.html;
266
+
267
+ location = /40x.html {
268
+
269
+ }
270
+
271
+
272
+
273
+ error_page 500 502 503 504 /50x.html;
274
+
275
+ location = /50x.html {
276
+
277
+ }
278
+
279
+ }
280
+
281
+
282
+
283
+ # Settings for a TLS enabled server.
284
+
285
+ #
286
+
287
+ # server {
288
+
289
+ # listen 443 ssl http2 default_server;
290
+
291
+ # listen [::]:443 ssl http2 default_server;
292
+
293
+ # server_name _;
294
+
295
+ # root /usr/share/nginx/html;
296
+
297
+ #
298
+
299
+ # ssl_certificate "/etc/pki/nginx/server.crt";
300
+
301
+ # ssl_certificate_key "/etc/pki/nginx/private/server.key";
302
+
303
+ # ssl_session_cache shared:SSL:1m;
304
+
305
+ # ssl_session_timeout 10m;
306
+
307
+ # ssl_ciphers HIGH:!aNULL:!MD5;
308
+
309
+ # ssl_prefer_server_ciphers on;
310
+
311
+ #
312
+
313
+ # # Load configuration files for the default server block.
314
+
315
+ # include /etc/nginx/default.d/*.conf;
316
+
317
+ #
318
+
319
+ # location / {
320
+
321
+ # }
322
+
323
+ #
324
+
325
+ # error_page 404 /404.html;
326
+
327
+ # location = /40x.html {
328
+
329
+ # }
330
+
331
+ #
332
+
333
+ # error_page 500 502 503 504 /50x.html;
334
+
335
+ # location = /50x.html {
336
+
337
+ # }
338
+
339
+ # }
340
+
341
+ ```
342
+
343
+
344
+
345
+
346
+
117
347
  ### nginxのシンタックスチェック、再起動後のステータス確認結果
118
348
 
119
349
  ```bash

2

タイトルを変更しました

2019/10/16 03:03

投稿

begenner
begenner

スコア79

test CHANGED
@@ -1 +1 @@
1
- Rails + AWS でHTTPS対応をしたい(nginx 403 Forbidden エラー)
1
+ Rails + AWS でHTTPS対応させたい(nginx 403 Forbidden エラー)
test CHANGED
File without changes

1

参考にしてきたサイトを追加しました

2019/10/15 14:55

投稿

begenner
begenner

スコア79

test CHANGED
File without changes
test CHANGED
@@ -32,6 +32,34 @@
32
32
 
33
33
 
34
34
 
35
+ ### デプロイ、HTTPS対応させるために参考にしてきたサイト
36
+
37
+ 1. アプリのデプロイまで
38
+
39
+ [(デプロイ編②)世界一丁寧なAWS解説。EC2を利用して、RailsアプリをAWSにあげるまで - Qiita](https://qiita.com/naoki_mochizuki/items/5a1757d222806cbe0cd1)
40
+
41
+
42
+
43
+ 2. HTTPS対応のために参考にした記事(2つ)
44
+
45
+ [[Rails][Nginx][AWS] Let's EncryptをEC2上のRailsに入れてHttpsにする - Qiita](https://qiita.com/Masahiro_T/items/9b81b31b3c21bd03fc09)
46
+
47
+ [Amazon Linux2とLet's EncryptでSSL対応サーバを0から爆速構築 - Qiita](https://qiita.com/MysteriousMonky/items/4d3d857c0e68d4bfff39)
48
+
49
+
50
+
51
+ 3. nginx設定ファイルの参考にしたサイト
52
+
53
+ [RailsアプリをAWS EC2で公開する超簡単な手順 【独自ドメイン/HTTPS対応】 - ひろこま Hack Log](https://www.mahirokazuko.com/entry/2018/09/11/112010)
54
+
55
+
56
+
57
+ 4. nginxとunicornの設定について(これを利用して編集はしていません)
58
+
59
+ [【Ruby on Rails】Nginxとunicornを使ってHTTPS(SSL)対応する方法 | Y-hilite](https://y-hilite.com/2908/)
60
+
61
+
62
+
35
63
  ### 動作環境
36
64
 
37
65
  Rails