質問編集履歴
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -117,3 +117,297 @@
|
|
117
117
|
|
118
118
|
|
119
119
|
dockerから実ファイルを探す方法も分からずそこから調べている状況です。
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
###追記
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
dockerから実ファイルにアクセスする方法分かりました。
|
130
|
+
|
131
|
+
wp-config.phpと、 wp-config-docker.phpというファイルが見つかりました。
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
試しにこれを編集してみようと思います。
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
wp-config.php
|
140
|
+
|
141
|
+
```php
|
142
|
+
|
143
|
+
<?php
|
144
|
+
|
145
|
+
/**
|
146
|
+
|
147
|
+
* The base configuration for WordPress
|
148
|
+
|
149
|
+
*
|
150
|
+
|
151
|
+
* The wp-config.php creation script uses this file during the installation.
|
152
|
+
|
153
|
+
* You don't have to use the web site, you can copy this file to "wp-config.php"
|
154
|
+
|
155
|
+
* and fill in the values.
|
156
|
+
|
157
|
+
*
|
158
|
+
|
159
|
+
* This file contains the following configurations:
|
160
|
+
|
161
|
+
*
|
162
|
+
|
163
|
+
* * MySQL settings
|
164
|
+
|
165
|
+
* * Secret keys
|
166
|
+
|
167
|
+
* * Database table prefix
|
168
|
+
|
169
|
+
* * ABSPATH
|
170
|
+
|
171
|
+
*
|
172
|
+
|
173
|
+
* This has been slightly modified (to read environment variables) for use in Docker.
|
174
|
+
|
175
|
+
*
|
176
|
+
|
177
|
+
* @link https://wordpress.org/support/article/editing-wp-config-php/
|
178
|
+
|
179
|
+
*
|
180
|
+
|
181
|
+
* @package WordPress
|
182
|
+
|
183
|
+
*/
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
// IMPORTANT: this file needs to stay in-sync with https://github.com/WordPress/WordPress/blob/master/wp-config-sample.php
|
188
|
+
|
189
|
+
// (it gets parsed by the upstream wizard in https://github.com/WordPress/WordPress/blob/f27cb65e1ef25d11b535695a660e7282b98eb742/wp-admin/setup-config.php#L356-L392)
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
// a helper function to lookup "env_FILE", "env", then fallback
|
194
|
+
|
195
|
+
if (!function_exists('getenv_docker')) {
|
196
|
+
|
197
|
+
// https://github.com/docker-library/wordpress/issues/588 (WP-CLI will load this file 2x)
|
198
|
+
|
199
|
+
function getenv_docker($env, $default) {
|
200
|
+
|
201
|
+
if ($fileEnv = getenv($env . '_FILE')) {
|
202
|
+
|
203
|
+
return rtrim(file_get_contents($fileEnv), "\r\n");
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
else if (($val = getenv($env)) !== false) {
|
208
|
+
|
209
|
+
return $val;
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
else {
|
214
|
+
|
215
|
+
return $default;
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
// ** MySQL settings - You can get this info from your web host ** //
|
226
|
+
|
227
|
+
/** The name of the database for WordPress */
|
228
|
+
|
229
|
+
define( 'DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'wordpress') );
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
/** MySQL database username */
|
234
|
+
|
235
|
+
define( 'DB_USER', getenv_docker('WORDPRESS_DB_USER', 'example username') );
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
/** MySQL database password */
|
240
|
+
|
241
|
+
define( 'DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', 'example password') );
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
/**
|
246
|
+
|
247
|
+
* Docker image fallback values above are sourced from the official WordPress installation wizard:
|
248
|
+
|
249
|
+
* https://github.com/WordPress/WordPress/blob/f9cc35ebad82753e9c86de322ea5c76a9001c7e2/wp-admin/setup-config.php#L216-L230
|
250
|
+
|
251
|
+
* (However, using "example username" and "example password" in your database is strongly discouraged. Please use strong, random credentials!)
|
252
|
+
|
253
|
+
*/
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
/** MySQL hostname */
|
258
|
+
|
259
|
+
define( 'DB_HOST', getenv_docker('WORDPRESS_DB_HOST', 'mysql') );
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
/** Database charset to use in creating database tables. */
|
264
|
+
|
265
|
+
define( 'DB_CHARSET', getenv_docker('WORDPRESS_DB_CHARSET', 'utf8') );
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
/** The database collate type. Don't change this if in doubt. */
|
270
|
+
|
271
|
+
define( 'DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', '') );
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
/**#@+
|
276
|
+
|
277
|
+
* Authentication unique keys and salts.
|
278
|
+
|
279
|
+
*
|
280
|
+
|
281
|
+
* Change these to different unique phrases! You can generate these using
|
282
|
+
|
283
|
+
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
|
284
|
+
|
285
|
+
*
|
286
|
+
|
287
|
+
* You can change these at any point in time to invalidate all existing cookies.
|
288
|
+
|
289
|
+
* This will force all users to have to log in again.
|
290
|
+
|
291
|
+
*
|
292
|
+
|
293
|
+
* @since 2.6.0
|
294
|
+
|
295
|
+
*/
|
296
|
+
|
297
|
+
define( 'AUTH_KEY', getenv_docker('WORDPRESS_AUTH_KEY', '044ecaa71e6317408882a5431804edfa001074e1') );
|
298
|
+
|
299
|
+
define( 'SECURE_AUTH_KEY', getenv_docker('WORDPRESS_SECURE_AUTH_KEY', '2b7a91d10294784fb57b7e1620d764170d11557e') );
|
300
|
+
|
301
|
+
define( 'LOGGED_IN_KEY', getenv_docker('WORDPRESS_LOGGED_IN_KEY', '93490a2477f86c7d6ab8a23c3f1ac3f20f75cd6e') );
|
302
|
+
|
303
|
+
define( 'NONCE_KEY', getenv_docker('WORDPRESS_NONCE_KEY', 'ef24dff849eaea2b6ca8bf43a3edc1cb70c8d7cf') );
|
304
|
+
|
305
|
+
define( 'AUTH_SALT', getenv_docker('WORDPRESS_AUTH_SALT', '73f41d4cf8231be0ea8f6b6107af7e2e58fd413c') );
|
306
|
+
|
307
|
+
define( 'SECURE_AUTH_SALT', getenv_docker('WORDPRESS_SECURE_AUTH_SALT', '59bd4b20cd75bae02700a26acfcd7fde88be7a6d') );
|
308
|
+
|
309
|
+
define( 'LOGGED_IN_SALT', getenv_docker('WORDPRESS_LOGGED_IN_SALT', 'f4878dc7342eb0bdd7d7899c21cb2070e7262081') );
|
310
|
+
|
311
|
+
define( 'NONCE_SALT', getenv_docker('WORDPRESS_NONCE_SALT', 'a3f043707b4ea89e42afb1c8103257195c5c570f') );
|
312
|
+
|
313
|
+
// (See also https://wordpress.stackexchange.com/a/152905/199287)
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
/**#@-*/
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
/**
|
322
|
+
|
323
|
+
* WordPress database table prefix.
|
324
|
+
|
325
|
+
*
|
326
|
+
|
327
|
+
* You can have multiple installations in one database if you give each
|
328
|
+
|
329
|
+
* a unique prefix. Only numbers, letters, and underscores please!
|
330
|
+
|
331
|
+
*/
|
332
|
+
|
333
|
+
$table_prefix = getenv_docker('WORDPRESS_TABLE_PREFIX', 'wp_');
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
/**
|
338
|
+
|
339
|
+
* For developers: WordPress debugging mode.
|
340
|
+
|
341
|
+
*
|
342
|
+
|
343
|
+
* Change this to true to enable the display of notices during development.
|
344
|
+
|
345
|
+
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
346
|
+
|
347
|
+
* in their development environments.
|
348
|
+
|
349
|
+
*
|
350
|
+
|
351
|
+
* For information on other constants that can be used for debugging,
|
352
|
+
|
353
|
+
* visit the documentation.
|
354
|
+
|
355
|
+
*
|
356
|
+
|
357
|
+
* @link https://wordpress.org/support/article/debugging-in-wordpress/
|
358
|
+
|
359
|
+
*/
|
360
|
+
|
361
|
+
define( 'WP_DEBUG', !!getenv_docker('WORDPRESS_DEBUG', '') );
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
/* Add any custom values between this line and the "stop editing" line. */
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
// If we're behind a proxy server and using HTTPS, we need to alert WordPress of that fact
|
370
|
+
|
371
|
+
// see also https://wordpress.org/support/article/administration-over-ssl/#using-a-reverse-proxy
|
372
|
+
|
373
|
+
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
|
374
|
+
|
375
|
+
$_SERVER['HTTPS'] = 'on';
|
376
|
+
|
377
|
+
}
|
378
|
+
|
379
|
+
// (we include this by default because reverse proxying is extremely common in container environments)
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
if ($configExtra = getenv_docker('WORDPRESS_CONFIG_EXTRA', '')) {
|
384
|
+
|
385
|
+
eval($configExtra);
|
386
|
+
|
387
|
+
}
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
/* That's all, stop editing! Happy publishing. */
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
/** Absolute path to the WordPress directory. */
|
396
|
+
|
397
|
+
if ( ! defined( 'ABSPATH' ) ) {
|
398
|
+
|
399
|
+
define( 'ABSPATH', __DIR__ . '/' );
|
400
|
+
|
401
|
+
}
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
/** Sets up WordPress vars and included files. */
|
406
|
+
|
407
|
+
require_once ABSPATH . 'wp-settings.php';
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
```
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -95,3 +95,25 @@
|
|
95
95
|
すいませんが分かる方教えていただけると幸いです。
|
96
96
|
|
97
97
|
宜しくお願い致します。
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
###追記
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
追記です。
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
[【開発環境構築】DockerでWordpressの開発環境構築をして「Error establishing a database connection」で繋がらないときはwp-config.phpを確認!](https://qiita.com/wallkickers/items/1e7af73dfd75d441dc0c#%E5%8E%9F%E5%9B%A02wp-configphp%E3%81%AEdb_host%E3%81%AFdb%E3%82%B3%E3%83%B3%E3%83%86%E3%83%8A%E5%90%8D)
|
112
|
+
|
113
|
+
上記によると、wp-config.php ファイルを編集する必要がありそうです。
|
114
|
+
|
115
|
+
dockerからこのファイルを編集する方法を調べてますがまだ見当たりません。
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
dockerから実ファイルを探す方法も分からずそこから調べている状況です。
|