質問編集履歴
1
nginxの設定を追加記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -227,3 +227,131 @@
|
|
227
227
|
end
|
228
228
|
|
229
229
|
```
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
### 追加補足
|
234
|
+
|
235
|
+
`/etc/nginx/conf.d/lcoin.conf`
|
236
|
+
|
237
|
+
```
|
238
|
+
|
239
|
+
#各種ログのディレクトリ設定
|
240
|
+
|
241
|
+
error_log /var/www/myapp/current/log/nginx.error.log;
|
242
|
+
|
243
|
+
access_log /var/www/myapp/current/log/nginx.access.log;
|
244
|
+
|
245
|
+
#処理を受け取る最大許容量
|
246
|
+
|
247
|
+
client_max_body_size 2G;
|
248
|
+
|
249
|
+
upstream app_server {
|
250
|
+
|
251
|
+
# 連携するunicornのソケットのパス
|
252
|
+
|
253
|
+
server unix:/var/www/myapp/current/tmp/sockets/.unicorn.sock fail_timeout=0;
|
254
|
+
|
255
|
+
}
|
256
|
+
|
257
|
+
server {
|
258
|
+
|
259
|
+
listen 443 ssl;
|
260
|
+
|
261
|
+
server_name staging.com;
|
262
|
+
|
263
|
+
ssl_certificate /etc/letsencrypt/live/staging.com/fullchain.pem;
|
264
|
+
|
265
|
+
ssl_certificate_key /etc/letsencrypt/live/staging.com/privkey.pem;
|
266
|
+
|
267
|
+
#次のリクエストが来るまでの待ち時間(秒
|
268
|
+
|
269
|
+
keepalive_timeout 45;
|
270
|
+
|
271
|
+
#静的ファイルを読みに行くディレクトリ
|
272
|
+
|
273
|
+
root /var/www/myapp/current/public;
|
274
|
+
|
275
|
+
#キャッシュのディレクトリ
|
276
|
+
|
277
|
+
try_files $uri/index.html $uri.html $uri @app;
|
278
|
+
|
279
|
+
location @app {
|
280
|
+
|
281
|
+
# HTTP headers
|
282
|
+
|
283
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
284
|
+
|
285
|
+
proxy_set_header X-FORWARDED_PROTO https;
|
286
|
+
|
287
|
+
proxy_set_header Host $http_host;
|
288
|
+
|
289
|
+
proxy_redirect off;
|
290
|
+
|
291
|
+
proxy_pass http://app_server;
|
292
|
+
|
293
|
+
}
|
294
|
+
|
295
|
+
#エラーページを設置する場所
|
296
|
+
|
297
|
+
error_page 500 502 503 504 /500.html;
|
298
|
+
|
299
|
+
location = /500.html {
|
300
|
+
|
301
|
+
root /var/www/myapp/current/public;
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
}
|
306
|
+
|
307
|
+
server {
|
308
|
+
|
309
|
+
listen 443 ssl;
|
310
|
+
|
311
|
+
server_name production.com;
|
312
|
+
|
313
|
+
ssl_certificate /etc/letsencrypt/live/production.com/fullchain.pem;
|
314
|
+
|
315
|
+
ssl_certificate_key /etc/letsencrypt/live/production.com/privkey.pem;
|
316
|
+
|
317
|
+
#次のリクエストが来るまでの待ち時間(秒
|
318
|
+
|
319
|
+
keepalive_timeout 45;
|
320
|
+
|
321
|
+
#静的ファイルを読みに行くディレクトリ
|
322
|
+
|
323
|
+
root /var/www/myapp/current/public;
|
324
|
+
|
325
|
+
#キャッシュのディレクトリ
|
326
|
+
|
327
|
+
try_files $uri/index.html $uri.html $uri @app;
|
328
|
+
|
329
|
+
location @app {
|
330
|
+
|
331
|
+
# HTTP headers
|
332
|
+
|
333
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
334
|
+
|
335
|
+
proxy_set_header X-FORWARDED_PROTO https;
|
336
|
+
|
337
|
+
proxy_set_header Host $http_host;
|
338
|
+
|
339
|
+
proxy_redirect off;
|
340
|
+
|
341
|
+
proxy_pass http://app_server;
|
342
|
+
|
343
|
+
}
|
344
|
+
|
345
|
+
#エラーページを設置する場所
|
346
|
+
|
347
|
+
error_page 500 502 503 504 /500.html;
|
348
|
+
|
349
|
+
location = /500.html {
|
350
|
+
|
351
|
+
root /var/www/myapp/current/public;
|
352
|
+
|
353
|
+
}
|
354
|
+
|
355
|
+
}
|
356
|
+
|
357
|
+
```
|