質問編集履歴
1
nginxの設定を追加いたしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -255,3 +255,139 @@
|
|
255
255
|
container_name: mysql
|
256
256
|
|
257
257
|
```
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
追記:ホストからhttpにて接続できる事は確認しております。
|
262
|
+
|
263
|
+
そして、イメージ画像に誤りがありました。
|
264
|
+
|
265
|
+
イメージ画像ではクライアント、APIサーバーに各々nginxがあるイメージですが、正しくは1つのnginxに両方のサーバーがあり、ドメインで振り分けている設定になります。
|
266
|
+
|
267
|
+
もちろん本番環境は各サーバーでIPアドレスもドメインも違うのですが、開発環境は1つのdocker-composeで完結させたいため、このような構成を検討している状態になります。
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
default.conf(nginx)
|
272
|
+
|
273
|
+
```
|
274
|
+
|
275
|
+
server {
|
276
|
+
|
277
|
+
listen 80;
|
278
|
+
|
279
|
+
index index.php index.html;
|
280
|
+
|
281
|
+
server_name localhost;
|
282
|
+
|
283
|
+
include mime.types;
|
284
|
+
|
285
|
+
rewrite ^/(css|js)/(.*).\d+.(css|js)$ http://localhost/$1/$2.$3 redirect;
|
286
|
+
|
287
|
+
root /var/www/html/public_html;
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
location / {
|
292
|
+
|
293
|
+
try_files $uri $uri/ /index.php$is_args$args;
|
294
|
+
|
295
|
+
}
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
location ~ .php$ {
|
300
|
+
|
301
|
+
root /var/www/html/public_html;
|
302
|
+
|
303
|
+
fastcgi_split_path_info ^(.+.php)(/.+)$;
|
304
|
+
|
305
|
+
fastcgi_pass code:9000;
|
306
|
+
|
307
|
+
fastcgi_index index.php;
|
308
|
+
|
309
|
+
include fastcgi_params;
|
310
|
+
|
311
|
+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
312
|
+
|
313
|
+
fastcgi_param PATH_INFO $fastcgi_path_info;
|
314
|
+
|
315
|
+
fastcgi_param CI_ENV development;
|
316
|
+
|
317
|
+
#各自切り替える事
|
318
|
+
|
319
|
+
fastcgi_param SERVER_NAME uchida;
|
320
|
+
|
321
|
+
}
|
322
|
+
|
323
|
+
location ~* .(ico|css|js|gif|jpe?g|png)(?[0-9]+)?$ {
|
324
|
+
|
325
|
+
root /var/www/html/public_html;
|
326
|
+
|
327
|
+
expires 0;
|
328
|
+
|
329
|
+
access_log off;
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
#rewrite ^/(css|js)/(.*).\d+.(css|js)$ http://localhost/$1/$2.$3 redirect;
|
334
|
+
|
335
|
+
sendfile off;
|
336
|
+
|
337
|
+
}
|
338
|
+
|
339
|
+
}
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
server {
|
344
|
+
|
345
|
+
listen 80;
|
346
|
+
|
347
|
+
index index.php index.html;
|
348
|
+
|
349
|
+
server_name api.localhost;
|
350
|
+
|
351
|
+
include mime.types;
|
352
|
+
|
353
|
+
root /var/www/html/api/public;
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
location / {
|
358
|
+
|
359
|
+
try_files $uri $uri/ /index.php$is_args$args;
|
360
|
+
|
361
|
+
}
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
location ~ .php$ {
|
366
|
+
|
367
|
+
root /var/www/html/api/public;
|
368
|
+
|
369
|
+
fastcgi_split_path_info ^(.+.php)(/.+)$;
|
370
|
+
|
371
|
+
fastcgi_pass laravel:9000;
|
372
|
+
|
373
|
+
fastcgi_index index.php;
|
374
|
+
|
375
|
+
include fastcgi_params;
|
376
|
+
|
377
|
+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
378
|
+
|
379
|
+
fastcgi_param PATH_INFO $fastcgi_path_info;
|
380
|
+
|
381
|
+
fastcgi_param CI_ENV development;
|
382
|
+
|
383
|
+
#各自切り替える事
|
384
|
+
|
385
|
+
fastcgi_param SERVER_NAME uchida;
|
386
|
+
|
387
|
+
}
|
388
|
+
|
389
|
+
}
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
```
|