質問編集履歴

3

httpd.conf ssl.conf編集しました

2021/08/13 09:36

投稿

Athenahack
Athenahack

スコア2

test CHANGED
File without changes
test CHANGED
@@ -226,10 +226,16 @@
226
226
 
227
227
 
228
228
 
229
+
230
+
229
231
  var/www/phpMyAdmin/のユーザーとグループの所有者はapacheに変えました。
230
232
 
231
233
 
232
234
 
235
+ ######追記 httpd.confの中身 
236
+
237
+ mod_sslを入れたところ、ssl.confが編集できるようになったのでssl.confを設定した上でhttpd.confを編集しました。
238
+
233
239
 
234
240
 
235
241
  ```httpd.conf
@@ -264,8 +270,6 @@
264
270
 
265
271
  Listen 80
266
272
 
267
- Listen 443
268
-
269
273
 
270
274
 
271
275
  #
@@ -290,14 +294,6 @@
290
294
 
291
295
  #
292
296
 
293
-
294
-
295
- #
296
-
297
-
298
-
299
- #
300
-
301
297
  User apache
302
298
 
303
299
  Group apache
@@ -348,14 +344,6 @@
348
344
 
349
345
  #
350
346
 
351
-
352
-
353
- #
354
-
355
-
356
-
357
- #
358
-
359
347
  DocumentRoot "/var/www/html"
360
348
 
361
349
 
@@ -810,4 +798,4 @@
810
798
 
811
799
 
812
800
 
813
- か設定ミスありますでしょうか?
801
+ ssl.confを設定した上でですが、どこか設定ミスありますでしょうか?

2

SSL

2021/08/13 09:36

投稿

Athenahack
Athenahack

スコア2

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,9 @@
32
32
 
33
33
 
34
34
 
35
-
35
+ これを参照してSSL化しました。
36
+
37
+ https://dev.classmethod.jp/articles/make-amazon-lightsail-instance-https/
36
38
 
37
39
 
38
40
 
@@ -214,6 +216,12 @@
214
216
 
215
217
 
216
218
 
219
+ これを参照してSSL化しました。
220
+
221
+ https://dev.classmethod.jp/articles/make-amazon-lightsail-instance-https/
222
+
223
+
224
+
217
225
  以下、apahceの設定ファイルです。
218
226
 
219
227
 

1

追記しました

2021/08/13 07:20

投稿

Athenahack
Athenahack

スコア2

test CHANGED
File without changes
test CHANGED
@@ -10,10 +10,6 @@
10
10
 
11
11
 
12
12
 
13
-
14
-
15
-
16
-
17
13
  ●環境
18
14
 
19
15
  AWS Lightsail(Amazon linux 2)
@@ -84,4 +80,726 @@
84
80
 
85
81
 
86
82
 
83
+ SSL化する前まで~~はログインできていたので、~~もログインできていなかった気がします。
84
+
87
- SSL化する前まではログインできていたので、SSL化した後にphpmyadmin/以降のディレクトリにアクセスできないという事象になります。
85
+ SSL化した後にphpmyadmin/以降のディレクトリにアクセスできないという事象になります。
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ ###追記  起きている事象のパターンかきます
100
+
101
+
102
+
103
+ まずSSL化状態の
104
+
105
+
106
+
107
+ https://○○○/phpMyAdminでアクセスすると英語表記になります。
108
+
109
+
110
+
111
+ ログインしようとすると下記504エラーが出力されます。
112
+
113
+
114
+
115
+ #####タイムアウトの上限設定が原因?
116
+
117
+ apache設定ファイルでタイムアウトを上限まで変えましたが同様です。CloudFront側でもタイムアウトを上限まで上げましたが同様でした。
118
+
119
+
120
+
121
+ ```
122
+
123
+
124
+
125
+ 「504 ERROR
126
+
127
+ The request could not be satisfied.
128
+
129
+ CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection.
130
+
131
+ We can't connect to the server for this app or website at this time.
132
+
133
+ There might be too much traffic or a configuration error.
134
+
135
+ Try again later, or contact the app or website owner.
136
+
137
+ If you provide content to customers through CloudFront,
138
+
139
+ you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.」
140
+
141
+ ```
142
+
143
+
144
+
145
+ おそらくタイムアウト設定は関係なく、CloudFrontでSSL化した際の設定とかApache設定ファイルに問題があるかとは理解してます。
146
+
147
+
148
+
149
+
150
+
151
+ #####httpとhttpsそれぞれでアクセスしたときの違い
152
+
153
+
154
+
155
+ **https**://○○○/phpMyAdmin
156
+
157
+
158
+
159
+ 英語表記になる。
160
+
161
+ ログインすると上記の504エラー出る → サイト更新すると一番最初に記載した問題の下記が出力されます
162
+
163
+ ```
164
+
165
+ 「Failed to set session cookie.
166
+
167
+ Maybe you are using HTTP instead of HTTPS to access phpMyAdmin.」
168
+
169
+ ```
170
+
171
+ ___
172
+
173
+
174
+
175
+ **http**://○○○/phpMyAdmin
176
+
177
+
178
+
179
+ 日本語表記になる。 SSL化する前のインストールした状態と同じ。
180
+
181
+
182
+
183
+ ログインすると上記の504エラー出る → サイト更新すると一番最初に記載した問題の下記が出力されます
184
+
185
+ SSL化する前のphpMyAdminインストールした当初はログインできていたのですが、今は504エラーが出ます。
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+ ___
194
+
195
+
196
+
197
+
198
+
199
+ **https**://○○○/**phpinfo.php**
200
+
201
+
202
+
203
+ phpMyAdmin以外は普通に何の問題もなく表示されます。
204
+
205
+
206
+
207
+
208
+
209
+ ___
210
+
211
+
212
+
213
+ #####cloudfrontにSSL証明書設定後、apacheですべき設定は何でしょうか?
214
+
215
+
216
+
217
+ 以下、apahceの設定ファイルです。
218
+
219
+
220
+
221
+ var/www/phpMyAdmin/のユーザーとグループの所有者はapacheに変えました。
222
+
223
+
224
+
225
+
226
+
227
+ ```httpd.conf
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+ #
236
+
237
+ # ServerRoot: The top of the directory tree under which the server's
238
+
239
+ # configuration, error, and log files are kept.
240
+
241
+
242
+
243
+
244
+
245
+ #
246
+
247
+ ServerRoot "/etc/httpd"
248
+
249
+
250
+
251
+ #
252
+
253
+
254
+
255
+ #Listen 12.34.56.78:80
256
+
257
+ Listen 80
258
+
259
+ Listen 443
260
+
261
+
262
+
263
+ #
264
+
265
+ # Dynamic Shared Object (DSO) Support
266
+
267
+ #
268
+
269
+ #
270
+
271
+ #
272
+
273
+ # Example:
274
+
275
+ # LoadModule foo_module modules/mod_foo.so
276
+
277
+ #
278
+
279
+ Include conf.modules.d/*.conf
280
+
281
+
282
+
283
+ #
284
+
285
+
286
+
287
+ #
288
+
289
+
290
+
291
+ #
292
+
293
+ User apache
294
+
295
+ Group apache
296
+
297
+
298
+
299
+ # 'Main' server configuration
300
+
301
+ #
302
+
303
+
304
+
305
+ #
306
+
307
+ ServerAdmin root@localhost
308
+
309
+
310
+
311
+ #
312
+
313
+
314
+
315
+ #
316
+
317
+ #ServerName www.example.com:80
318
+
319
+
320
+
321
+ #
322
+
323
+
324
+
325
+ #
326
+
327
+ <Directory />
328
+
329
+ AllowOverride None
330
+
331
+ Require all granted
332
+
333
+ </Directory>
334
+
335
+
336
+
337
+ #
338
+
339
+
340
+
341
+ #
342
+
343
+
344
+
345
+ #
346
+
347
+
348
+
349
+ #
350
+
351
+ DocumentRoot "/var/www/html"
352
+
353
+
354
+
355
+ #
356
+
357
+ # Relax access to content within /var/www.
358
+
359
+ #
360
+
361
+ <Directory "/var/www">
362
+
363
+ AllowOverride None
364
+
365
+ # Allow open access:
366
+
367
+ Require all granted
368
+
369
+ </Directory>
370
+
371
+
372
+
373
+ # Further relax access to the default document root:
374
+
375
+ <Directory "/var/www/html">
376
+
377
+ #
378
+
379
+ # Possible values for the Options directive are "None", "All",
380
+
381
+ # or any combination of:
382
+
383
+ # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
384
+
385
+ #
386
+
387
+ # Note that "MultiViews" must be named *explicitly* --- "Options All"
388
+
389
+ # doesn't give it to you.
390
+
391
+ #
392
+
393
+ # The Options directive is both complicated and important. Please see
394
+
395
+ # http://httpd.apache.org/docs/2.4/mod/core.html#options
396
+
397
+ # for more information.
398
+
399
+ #
400
+
401
+ Options Indexes FollowSymLinks
402
+
403
+
404
+
405
+ #
406
+
407
+ # AllowOverride controls what directives may be placed in .htaccess files.
408
+
409
+ # It can be "All", "None", or any combination of the keywords:
410
+
411
+ # Options FileInfo AuthConfig Limit
412
+
413
+ #
414
+
415
+ AllowOverride None
416
+
417
+
418
+
419
+ #
420
+
421
+ # Controls who can get stuff from this server.
422
+
423
+ #
424
+
425
+ Require all granted
426
+
427
+ </Directory>
428
+
429
+
430
+
431
+ #
432
+
433
+ # DirectoryIndex: sets the file that Apache will serve if a directory
434
+
435
+ # is requested.
436
+
437
+ #
438
+
439
+ <IfModule dir_module>
440
+
441
+ DirectoryIndex index.html
442
+
443
+ </IfModule>
444
+
445
+
446
+
447
+ #
448
+
449
+ # The following lines prevent .htaccess and .htpasswd files from being
450
+
451
+ # viewed by Web clients.
452
+
453
+ #
454
+
455
+ <Files ".ht*">
456
+
457
+ Require all denied
458
+
459
+ </Files>
460
+
461
+
462
+
463
+ #
464
+
465
+
466
+
467
+ #
468
+
469
+ ErrorLog "logs/error_log"
470
+
471
+
472
+
473
+ #
474
+
475
+ # LogLevel: Control the number of messages logged to the error_log.
476
+
477
+ # Possible values include: debug, info, notice, warn, error, crit,
478
+
479
+ # alert, emerg.
480
+
481
+ #
482
+
483
+ LogLevel warn
484
+
485
+
486
+
487
+ <IfModule log_config_module>
488
+
489
+ #
490
+
491
+ # The following directives define some format nicknames for use with
492
+
493
+ # a CustomLog directive (see below).
494
+
495
+ #
496
+
497
+ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
498
+
499
+ LogFormat "%h %l %u %t \"%r\" %>s %b" common
500
+
501
+
502
+
503
+ <IfModule logio_module>
504
+
505
+ # You need to enable mod_logio.c to use %I and %O
506
+
507
+ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
508
+
509
+ </IfModule>
510
+
511
+
512
+
513
+ #
514
+
515
+ # The location and format of the access logfile (Common Logfile Format).
516
+
517
+ # If you do not define any access logfiles within a <VirtualHost>
518
+
519
+ # container, they will be logged here. Contrariwise, if you *do*
520
+
521
+ # define per-<VirtualHost> access logfiles, transactions will be
522
+
523
+ # logged therein and *not* in this file.
524
+
525
+ #
526
+
527
+ #CustomLog "logs/access_log" common
528
+
529
+
530
+
531
+ #
532
+
533
+ # If you prefer a logfile with access, agent, and referer information
534
+
535
+ # (Combined Logfile Format) you can use the following directive.
536
+
537
+ #
538
+
539
+ CustomLog "logs/access_log" combined
540
+
541
+ </IfModule>
542
+
543
+
544
+
545
+ <IfModule alias_module>
546
+
547
+ #
548
+
549
+
550
+
551
+ # Example:
552
+
553
+ # Redirect permanent /foo http://www.example.com/bar
554
+
555
+
556
+
557
+ #
558
+
559
+ # Alias: Maps web paths into filesystem paths and is used to
560
+
561
+ # access content that does not live under the DocumentRoot.
562
+
563
+ # Example:
564
+
565
+ # Alias /webpath /full/filesystem/path
566
+
567
+ #
568
+
569
+
570
+
571
+
572
+
573
+ #
574
+
575
+
576
+
577
+ #
578
+
579
+ ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
580
+
581
+
582
+
583
+ </IfModule>
584
+
585
+
586
+
587
+ #
588
+
589
+ # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
590
+
591
+ # CGI directory exists, if you have that configured.
592
+
593
+ #
594
+
595
+ <Directory "/var/www/cgi-bin">
596
+
597
+ AllowOverride None
598
+
599
+ Options None
600
+
601
+ Require all granted
602
+
603
+ </Directory>
604
+
605
+
606
+
607
+ <IfModule mime_module>
608
+
609
+ #
610
+
611
+ # TypesConfig points to the file containing the list of mappings from
612
+
613
+ # filename extension to MIME-type.
614
+
615
+ #
616
+
617
+ TypesConfig /etc/mime.types
618
+
619
+
620
+
621
+ #
622
+
623
+ # AddType allows you to add to or override the MIME configuration
624
+
625
+ # file specified in TypesConfig for specific file types.
626
+
627
+ #
628
+
629
+ #AddType application/x-gzip .tgz
630
+
631
+ #
632
+
633
+
634
+
635
+ #
636
+
637
+ #AddEncoding x-compress .Z
638
+
639
+ #AddEncoding x-gzip .gz .tgz
640
+
641
+ #
642
+
643
+ # If the AddEncoding directives above are commented-out, then you
644
+
645
+ # probably should define those extensions to indicate media types:
646
+
647
+ #
648
+
649
+ AddType application/x-compress .Z
650
+
651
+ AddType application/x-gzip .gz .tgz
652
+
653
+
654
+
655
+ #
656
+
657
+
658
+
659
+ #
660
+
661
+ # To use CGI scripts outside of ScriptAliased directories:
662
+
663
+ # (You will also need to add "ExecCGI" to the "Options" directive.)
664
+
665
+ #
666
+
667
+ #AddHandler cgi-script .cgi
668
+
669
+
670
+
671
+ # For type maps (negotiated resources):
672
+
673
+ #AddHandler type-map var
674
+
675
+
676
+
677
+ #
678
+
679
+ # Filters allow you to process content before it is sent to the client.
680
+
681
+ #
682
+
683
+ # To parse .shtml files for server-side includes (SSI):
684
+
685
+ # (You will also need to add "Includes" to the "Options" directive.)
686
+
687
+ #
688
+
689
+ AddType text/html .shtml
690
+
691
+ AddOutputFilter INCLUDES .shtml
692
+
693
+ </IfModule>
694
+
695
+
696
+
697
+ #
698
+
699
+
700
+
701
+ #
702
+
703
+ AddDefaultCharset UTF-8
704
+
705
+
706
+
707
+ <IfModule mime_magic_module>
708
+
709
+ #
710
+
711
+ # The mod_mime_magic module allows the server to use various hints from the
712
+
713
+ # contents of the file itself to determine its type. The MIMEMagicFile
714
+
715
+ # directive tells the module where the hint definitions are located.
716
+
717
+ #
718
+
719
+ MIMEMagicFile conf/magic
720
+
721
+ </IfModule>
722
+
723
+
724
+
725
+ #
726
+
727
+ # Customizable error responses come in three flavors:
728
+
729
+ # 1) plain text 2) local redirects 3) external redirects
730
+
731
+ #
732
+
733
+ # Some examples:
734
+
735
+ #ErrorDocument 500 "The server made a boo boo."
736
+
737
+ #ErrorDocument 404 /missing.html
738
+
739
+ #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
740
+
741
+ #ErrorDocument 402 http://www.example.com/subscription_info.html
742
+
743
+ #
744
+
745
+
746
+
747
+ #
748
+
749
+
750
+
751
+ # Defaults if commented: EnableMMAP On, EnableSendfile Off
752
+
753
+ #
754
+
755
+ #EnableMMAP off
756
+
757
+ EnableSendfile on
758
+
759
+
760
+
761
+ # Enable HTTP/2 by default
762
+
763
+ #
764
+
765
+ # https://httpd.apache.org/docs/2.4/mod/core.html#protocols
766
+
767
+
768
+
769
+
770
+
771
+ <IfModule mod_http2.c>
772
+
773
+ Protocols h2 h2c http/1.1
774
+
775
+ </IfModule>
776
+
777
+
778
+
779
+
780
+
781
+ # Supplemental configuration
782
+
783
+ #
784
+
785
+ # Load config files in the "/etc/httpd/conf.d" directory, if any.
786
+
787
+ IncludeOptional conf.d/*.conf
788
+
789
+
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+ ```
802
+
803
+
804
+
805
+ 何か設定ミスありますでしょうか?