質問編集履歴

3

書式

2020/05/14 03:16

投稿

mmmmmr
mmmmmr

スコア18

test CHANGED
File without changes
test CHANGED
@@ -478,6 +478,8 @@
478
478
 
479
479
  }
480
480
 
481
+ ```
482
+
481
483
 
482
484
 
483
485
  #追記2
@@ -503,9 +505,3 @@
503
505
  30 root 0:00 grep nginx
504
506
 
505
507
  ```
506
-
507
-
508
-
509
-
510
-
511
- ```

2

追記

2020/05/14 03:16

投稿

mmmmmr
mmmmmr

スコア18

test CHANGED
File without changes
test CHANGED
@@ -210,7 +210,9 @@
210
210
 
211
211
  server_nginx に入ってcurlコマンドを実施したところ、エラーが出ました。
212
212
 
213
- nginxのプロセスもうまく立ち上がっていないようです。
213
+ ~~nginxのプロセスもうまく立ち上がっていないようです。~~
214
+
215
+  →ローカルで実行していました。dockerコンテナ内ではきちんと動いているようでした。(追記2参照)
214
216
 
215
217
  ```
216
218
 
@@ -478,4 +480,32 @@
478
480
 
479
481
 
480
482
 
483
+ #追記2
484
+
485
+ すみません、nginxコンテナ内でプロセス確認したところ、きちんと動いているようでした…。
486
+
481
- ```
487
+ ```
488
+
489
+ $ docker exec -it server_nginx sh
490
+
491
+ / # ps -ef | grep nginx
492
+
493
+ 1 root 0:00 nginx: master process nginx -g daemon off;
494
+
495
+ 6 nginx 0:00 nginx: worker process
496
+
497
+ 7 nginx 0:00 nginx: worker process
498
+
499
+ 8 nginx 0:00 nginx: worker process
500
+
501
+ 9 nginx 0:00 nginx: worker process
502
+
503
+ 30 root 0:00 grep nginx
504
+
505
+ ```
506
+
507
+
508
+
509
+
510
+
511
+ ```

1

追記

2020/05/14 03:15

投稿

mmmmmr
mmmmmr

スコア18

test CHANGED
File without changes
test CHANGED
@@ -199,3 +199,283 @@
199
199
 
200
200
 
201
201
  ```
202
+
203
+
204
+
205
+ #追記
206
+
207
+
208
+
209
+ Yasumichi さんにご教示いただき、
210
+
211
+ server_nginx に入ってcurlコマンドを実施したところ、エラーが出ました。
212
+
213
+ nginxのプロセスもうまく立ち上がっていないようです。
214
+
215
+ ```
216
+
217
+ $ docker exec -it server_nginx sh
218
+
219
+ > curl https://localhost
220
+
221
+ curl: (7) Failed to connect to localhost port 443: Connection refused
222
+
223
+
224
+
225
+ $ps -ef | grep nginx
226
+
227
+ 502 3876 1164 0 11:06AM ttys006 0:00.00 grep nginx
228
+
229
+ ```
230
+
231
+
232
+
233
+
234
+
235
+ `docker-compose up -d`の際に、exitするため、
236
+
237
+ nginx.confの以下の表記を一度消した状態で`docker-compose up -d`を実行し、
238
+
239
+ あとから同じ箇所を書き加えているのですがそれが問題でしょうか…?
240
+
241
+ ```
242
+
243
+ server {
244
+
245
+ listen 443;
246
+
247
+ server_name _;
248
+
249
+   ……
250
+
251
+ ```
252
+
253
+
254
+
255
+ ```nginxconf
256
+
257
+ worker_processes auto;
258
+
259
+
260
+
261
+ error_log /dev/fd/1 crit;
262
+
263
+
264
+
265
+ pid /var/run/nginx.pid;
266
+
267
+ worker_rlimit_nofile 51200;
268
+
269
+
270
+
271
+
272
+
273
+ events {
274
+
275
+ use epoll;
276
+
277
+ worker_connections 51200;
278
+
279
+ multi_accept on;
280
+
281
+ accept_mutex_delay 100ms;
282
+
283
+ }
284
+
285
+
286
+
287
+
288
+
289
+ http {
290
+
291
+ include mime.types;
292
+
293
+ default_type application/octet-stream;
294
+
295
+
296
+
297
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
298
+
299
+ '$status $body_bytes_sent "$http_referer" '
300
+
301
+ '"$http_user_agent" "$http_x_forwarded_for"';
302
+
303
+
304
+
305
+ access_log /dev/fd/1 main;
306
+
307
+
308
+
309
+ client_max_body_size 100m; #add
310
+
311
+ sendfile on;
312
+
313
+ keepalive_timeout 120;
314
+
315
+ tcp_nopush on;
316
+
317
+ open_file_cache max=100 inactive=20s;
318
+
319
+
320
+
321
+
322
+
323
+ gzip on;
324
+
325
+
326
+
327
+ server {
328
+
329
+ listen 80;
330
+
331
+ server_name _;
332
+
333
+
334
+
335
+ root /app/public;
336
+
337
+ index index.php index.html;
338
+
339
+
340
+
341
+ location / {
342
+
343
+ try_files $uri $uri/ /index.php?$query_string;
344
+
345
+ }
346
+
347
+
348
+
349
+ error_page 500 502 503 504 /50x.html;
350
+
351
+ location = /50x.html {
352
+
353
+ root html;
354
+
355
+ }
356
+
357
+
358
+
359
+ location ~ .php$ {
360
+
361
+ root /app/public;
362
+
363
+ fastcgi_param HTTP_HOST $host;
364
+
365
+ fastcgi_param HTTP_X_REAL_IP $remote_addr;
366
+
367
+ fastcgi_param HTTP_X_FORWARDED_HOST $host;
368
+
369
+ fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
370
+
371
+ fastcgi_param HTTP_X_REMOTE_ADDR $remote_addr;
372
+
373
+ fastcgi_pass app:9000;
374
+
375
+ fastcgi_split_path_info ^(.+.php)(/.+)$;
376
+
377
+ fastcgi_index index.php;
378
+
379
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
380
+
381
+ include fastcgi_params;
382
+
383
+ }
384
+
385
+
386
+
387
+ location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
388
+
389
+ expires max;
390
+
391
+ access_log off;
392
+
393
+ }
394
+
395
+ }
396
+
397
+ server {
398
+
399
+ listen 443;
400
+
401
+ server_name _;
402
+
403
+
404
+
405
+ ssl on;
406
+
407
+ ssl_certificate /etc/nginx/ssl/server.crt;
408
+
409
+ ssl_certificate_key /etc/nginx/ssl/server.key;
410
+
411
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
412
+
413
+
414
+
415
+ root /app/public;
416
+
417
+ index index.php index.html;
418
+
419
+
420
+
421
+ location / {
422
+
423
+ try_files $uri $uri/ /index.php?$query_string;
424
+
425
+ }
426
+
427
+
428
+
429
+ error_page 500 502 503 504 /50x.html;
430
+
431
+ location = /50x.html {
432
+
433
+ root html;
434
+
435
+ }
436
+
437
+
438
+
439
+ location ~ .php$ {
440
+
441
+ root /app/public;
442
+
443
+ fastcgi_param HTTP_HOST $host;
444
+
445
+ fastcgi_param HTTP_X_REAL_IP $remote_addr;
446
+
447
+ fastcgi_param HTTP_X_FORWARDED_HOST $host;
448
+
449
+ fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
450
+
451
+ fastcgi_param HTTP_X_REMOTE_ADDR $remote_addr;
452
+
453
+ fastcgi_pass app:9000;
454
+
455
+ fastcgi_split_path_info ^(.+.php)(/.+)$;
456
+
457
+ fastcgi_index index.php;
458
+
459
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
460
+
461
+ include fastcgi_params;
462
+
463
+ }
464
+
465
+
466
+
467
+ location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
468
+
469
+ expires max;
470
+
471
+ access_log off;
472
+
473
+ }
474
+
475
+ }
476
+
477
+ }
478
+
479
+
480
+
481
+ ```