teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

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

2021/08/13 09:36

投稿

Athenahack
Athenahack

スコア2

title CHANGED
File without changes
body CHANGED
@@ -112,8 +112,11 @@
112
112
 
113
113
  以下、apahceの設定ファイルです。
114
114
 
115
+
115
116
  var/www/phpMyAdmin/のユーザーとグループの所有者はapacheに変えました。
116
117
 
118
+ ######追記 httpd.confの中身 
119
+ mod_sslを入れたところ、ssl.confが編集できるようになったのでssl.confを設定した上でhttpd.confを編集しました。
117
120
 
118
121
  ```httpd.conf
119
122
 
@@ -131,7 +134,6 @@
131
134
 
132
135
  #Listen 12.34.56.78:80
133
136
  Listen 80
134
- Listen 443
135
137
 
136
138
  #
137
139
  # Dynamic Shared Object (DSO) Support
@@ -144,10 +146,6 @@
144
146
  Include conf.modules.d/*.conf
145
147
 
146
148
  #
147
-
148
- #
149
-
150
- #
151
149
  User apache
152
150
  Group apache
153
151
 
@@ -173,10 +171,6 @@
173
171
  #
174
172
 
175
173
  #
176
-
177
- #
178
-
179
- #
180
174
  DocumentRoot "/var/www/html"
181
175
 
182
176
  #
@@ -404,4 +398,4 @@
404
398
 
405
399
  ```
406
400
 
407
- か設定ミスありますでしょうか?
401
+ ssl.confを設定した上でですが、どこか設定ミスありますでしょうか?

2

SSL

2021/08/13 09:36

投稿

Athenahack
Athenahack

スコア2

title CHANGED
File without changes
body CHANGED
@@ -15,8 +15,9 @@
15
15
  Route53 (ドメイン取得、各レコード設定で使用)
16
16
 
17
17
 
18
+ これを参照してSSL化しました。
19
+ https://dev.classmethod.jp/articles/make-amazon-lightsail-instance-https/
18
20
 
19
-
20
21
  ###発生している問題・エラーメッセージ
21
22
  SSL化をした段階でphpMyAdminにログインしようとすると
22
23
  ```
@@ -106,6 +107,9 @@
106
107
 
107
108
  #####cloudfrontにSSL証明書設定後、apacheですべき設定は何でしょうか?
108
109
 
110
+ これを参照してSSL化しました。
111
+ https://dev.classmethod.jp/articles/make-amazon-lightsail-instance-https/
112
+
109
113
  以下、apahceの設定ファイルです。
110
114
 
111
115
  var/www/phpMyAdmin/のユーザーとグループの所有者はapacheに変えました。

1

追記しました

2021/08/13 07:20

投稿

Athenahack
Athenahack

スコア2

title CHANGED
File without changes
body CHANGED
@@ -4,8 +4,6 @@
4
4
 
5
5
 
6
6
 
7
-
8
-
9
7
  ●環境
10
8
  AWS Lightsail(Amazon linux 2)
11
9
  PHP7.4 / MySQL 8.0 / Apache 2.4
@@ -41,4 +39,365 @@
41
39
 
42
40
  おそらくapacheのSSL設定まわりかcloudfrontのHTTPやHTTPSの設定ができていないんだと思います。
43
41
 
42
+ SSL化する前まで~~はログインできていたので、~~もログインできていなかった気がします。
44
- SSL化する前まではログインできていたので、SSL化した後にphpmyadmin/以降のディレクトリにアクセスできないという事象になります。
43
+ SSL化した後にphpmyadmin/以降のディレクトリにアクセスできないという事象になります。
44
+
45
+
46
+
47
+
48
+
49
+
50
+ ###追記  起きている事象のパターンかきます
51
+
52
+ まずSSL化状態の
53
+
54
+ https://○○○/phpMyAdminでアクセスすると英語表記になります。
55
+
56
+ ログインしようとすると下記504エラーが出力されます。
57
+
58
+ #####タイムアウトの上限設定が原因?
59
+ apache設定ファイルでタイムアウトを上限まで変えましたが同様です。CloudFront側でもタイムアウトを上限まで上げましたが同様でした。
60
+
61
+ ```
62
+
63
+ 「504 ERROR
64
+ The request could not be satisfied.
65
+ CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection.
66
+ We can't connect to the server for this app or website at this time.
67
+ There might be too much traffic or a configuration error.
68
+ Try again later, or contact the app or website owner.
69
+ If you provide content to customers through CloudFront,
70
+ you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.」
71
+ ```
72
+
73
+ おそらくタイムアウト設定は関係なく、CloudFrontでSSL化した際の設定とかApache設定ファイルに問題があるかとは理解してます。
74
+
75
+
76
+ #####httpとhttpsそれぞれでアクセスしたときの違い
77
+
78
+ **https**://○○○/phpMyAdmin
79
+
80
+ 英語表記になる。
81
+ ログインすると上記の504エラー出る → サイト更新すると一番最初に記載した問題の下記が出力されます
82
+ ```
83
+ 「Failed to set session cookie.
84
+ Maybe you are using HTTP instead of HTTPS to access phpMyAdmin.」
85
+ ```
86
+ ___
87
+
88
+ **http**://○○○/phpMyAdmin
89
+
90
+ 日本語表記になる。 SSL化する前のインストールした状態と同じ。
91
+
92
+ ログインすると上記の504エラー出る → サイト更新すると一番最初に記載した問題の下記が出力されます
93
+ SSL化する前のphpMyAdminインストールした当初はログインできていたのですが、今は504エラーが出ます。
94
+
95
+
96
+
97
+ ___
98
+
99
+
100
+ **https**://○○○/**phpinfo.php**
101
+
102
+ phpMyAdmin以外は普通に何の問題もなく表示されます。
103
+
104
+
105
+ ___
106
+
107
+ #####cloudfrontにSSL証明書設定後、apacheですべき設定は何でしょうか?
108
+
109
+ 以下、apahceの設定ファイルです。
110
+
111
+ var/www/phpMyAdmin/のユーザーとグループの所有者はapacheに変えました。
112
+
113
+
114
+ ```httpd.conf
115
+
116
+
117
+
118
+ #
119
+ # ServerRoot: The top of the directory tree under which the server's
120
+ # configuration, error, and log files are kept.
121
+
122
+
123
+ #
124
+ ServerRoot "/etc/httpd"
125
+
126
+ #
127
+
128
+ #Listen 12.34.56.78:80
129
+ Listen 80
130
+ Listen 443
131
+
132
+ #
133
+ # Dynamic Shared Object (DSO) Support
134
+ #
135
+ #
136
+ #
137
+ # Example:
138
+ # LoadModule foo_module modules/mod_foo.so
139
+ #
140
+ Include conf.modules.d/*.conf
141
+
142
+ #
143
+
144
+ #
145
+
146
+ #
147
+ User apache
148
+ Group apache
149
+
150
+ # 'Main' server configuration
151
+ #
152
+
153
+ #
154
+ ServerAdmin root@localhost
155
+
156
+ #
157
+
158
+ #
159
+ #ServerName www.example.com:80
160
+
161
+ #
162
+
163
+ #
164
+ <Directory />
165
+ AllowOverride None
166
+ Require all granted
167
+ </Directory>
168
+
169
+ #
170
+
171
+ #
172
+
173
+ #
174
+
175
+ #
176
+ DocumentRoot "/var/www/html"
177
+
178
+ #
179
+ # Relax access to content within /var/www.
180
+ #
181
+ <Directory "/var/www">
182
+ AllowOverride None
183
+ # Allow open access:
184
+ Require all granted
185
+ </Directory>
186
+
187
+ # Further relax access to the default document root:
188
+ <Directory "/var/www/html">
189
+ #
190
+ # Possible values for the Options directive are "None", "All",
191
+ # or any combination of:
192
+ # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
193
+ #
194
+ # Note that "MultiViews" must be named *explicitly* --- "Options All"
195
+ # doesn't give it to you.
196
+ #
197
+ # The Options directive is both complicated and important. Please see
198
+ # http://httpd.apache.org/docs/2.4/mod/core.html#options
199
+ # for more information.
200
+ #
201
+ Options Indexes FollowSymLinks
202
+
203
+ #
204
+ # AllowOverride controls what directives may be placed in .htaccess files.
205
+ # It can be "All", "None", or any combination of the keywords:
206
+ # Options FileInfo AuthConfig Limit
207
+ #
208
+ AllowOverride None
209
+
210
+ #
211
+ # Controls who can get stuff from this server.
212
+ #
213
+ Require all granted
214
+ </Directory>
215
+
216
+ #
217
+ # DirectoryIndex: sets the file that Apache will serve if a directory
218
+ # is requested.
219
+ #
220
+ <IfModule dir_module>
221
+ DirectoryIndex index.html
222
+ </IfModule>
223
+
224
+ #
225
+ # The following lines prevent .htaccess and .htpasswd files from being
226
+ # viewed by Web clients.
227
+ #
228
+ <Files ".ht*">
229
+ Require all denied
230
+ </Files>
231
+
232
+ #
233
+
234
+ #
235
+ ErrorLog "logs/error_log"
236
+
237
+ #
238
+ # LogLevel: Control the number of messages logged to the error_log.
239
+ # Possible values include: debug, info, notice, warn, error, crit,
240
+ # alert, emerg.
241
+ #
242
+ LogLevel warn
243
+
244
+ <IfModule log_config_module>
245
+ #
246
+ # The following directives define some format nicknames for use with
247
+ # a CustomLog directive (see below).
248
+ #
249
+ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
250
+ LogFormat "%h %l %u %t \"%r\" %>s %b" common
251
+
252
+ <IfModule logio_module>
253
+ # You need to enable mod_logio.c to use %I and %O
254
+ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
255
+ </IfModule>
256
+
257
+ #
258
+ # The location and format of the access logfile (Common Logfile Format).
259
+ # If you do not define any access logfiles within a <VirtualHost>
260
+ # container, they will be logged here. Contrariwise, if you *do*
261
+ # define per-<VirtualHost> access logfiles, transactions will be
262
+ # logged therein and *not* in this file.
263
+ #
264
+ #CustomLog "logs/access_log" common
265
+
266
+ #
267
+ # If you prefer a logfile with access, agent, and referer information
268
+ # (Combined Logfile Format) you can use the following directive.
269
+ #
270
+ CustomLog "logs/access_log" combined
271
+ </IfModule>
272
+
273
+ <IfModule alias_module>
274
+ #
275
+
276
+ # Example:
277
+ # Redirect permanent /foo http://www.example.com/bar
278
+
279
+ #
280
+ # Alias: Maps web paths into filesystem paths and is used to
281
+ # access content that does not live under the DocumentRoot.
282
+ # Example:
283
+ # Alias /webpath /full/filesystem/path
284
+ #
285
+
286
+
287
+ #
288
+
289
+ #
290
+ ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
291
+
292
+ </IfModule>
293
+
294
+ #
295
+ # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
296
+ # CGI directory exists, if you have that configured.
297
+ #
298
+ <Directory "/var/www/cgi-bin">
299
+ AllowOverride None
300
+ Options None
301
+ Require all granted
302
+ </Directory>
303
+
304
+ <IfModule mime_module>
305
+ #
306
+ # TypesConfig points to the file containing the list of mappings from
307
+ # filename extension to MIME-type.
308
+ #
309
+ TypesConfig /etc/mime.types
310
+
311
+ #
312
+ # AddType allows you to add to or override the MIME configuration
313
+ # file specified in TypesConfig for specific file types.
314
+ #
315
+ #AddType application/x-gzip .tgz
316
+ #
317
+
318
+ #
319
+ #AddEncoding x-compress .Z
320
+ #AddEncoding x-gzip .gz .tgz
321
+ #
322
+ # If the AddEncoding directives above are commented-out, then you
323
+ # probably should define those extensions to indicate media types:
324
+ #
325
+ AddType application/x-compress .Z
326
+ AddType application/x-gzip .gz .tgz
327
+
328
+ #
329
+
330
+ #
331
+ # To use CGI scripts outside of ScriptAliased directories:
332
+ # (You will also need to add "ExecCGI" to the "Options" directive.)
333
+ #
334
+ #AddHandler cgi-script .cgi
335
+
336
+ # For type maps (negotiated resources):
337
+ #AddHandler type-map var
338
+
339
+ #
340
+ # Filters allow you to process content before it is sent to the client.
341
+ #
342
+ # To parse .shtml files for server-side includes (SSI):
343
+ # (You will also need to add "Includes" to the "Options" directive.)
344
+ #
345
+ AddType text/html .shtml
346
+ AddOutputFilter INCLUDES .shtml
347
+ </IfModule>
348
+
349
+ #
350
+
351
+ #
352
+ AddDefaultCharset UTF-8
353
+
354
+ <IfModule mime_magic_module>
355
+ #
356
+ # The mod_mime_magic module allows the server to use various hints from the
357
+ # contents of the file itself to determine its type. The MIMEMagicFile
358
+ # directive tells the module where the hint definitions are located.
359
+ #
360
+ MIMEMagicFile conf/magic
361
+ </IfModule>
362
+
363
+ #
364
+ # Customizable error responses come in three flavors:
365
+ # 1) plain text 2) local redirects 3) external redirects
366
+ #
367
+ # Some examples:
368
+ #ErrorDocument 500 "The server made a boo boo."
369
+ #ErrorDocument 404 /missing.html
370
+ #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
371
+ #ErrorDocument 402 http://www.example.com/subscription_info.html
372
+ #
373
+
374
+ #
375
+
376
+ # Defaults if commented: EnableMMAP On, EnableSendfile Off
377
+ #
378
+ #EnableMMAP off
379
+ EnableSendfile on
380
+
381
+ # Enable HTTP/2 by default
382
+ #
383
+ # https://httpd.apache.org/docs/2.4/mod/core.html#protocols
384
+
385
+
386
+ <IfModule mod_http2.c>
387
+ Protocols h2 h2c http/1.1
388
+ </IfModule>
389
+
390
+
391
+ # Supplemental configuration
392
+ #
393
+ # Load config files in the "/etc/httpd/conf.d" directory, if any.
394
+ IncludeOptional conf.d/*.conf
395
+
396
+
397
+
398
+
399
+
400
+
401
+ ```
402
+
403
+ 何か設定ミスありますでしょうか?