質問編集履歴

1

質問の更新。

2019/02/08 11:17

投稿

daicky777
daicky777

スコア16

test CHANGED
File without changes
test CHANGED
@@ -3,6 +3,12 @@
3
3
  Railsでpre-compileしたassetsリソースをnginxから静的配信したいです。
4
4
 
5
5
  Railsの設定で`config.public_file_server.enabled = true`を設定し、Rails自身が静的コンテンツサーバーとして動作させる事によってリソースを配信可能なのですが、負荷軽減のため、nginxに配信を移譲したいの設定ファイルの書き方がわかりません。
6
+
7
+
8
+
9
+ そもそも時下にrailsにアクセスしてもpublic以下は参照できません。
10
+
11
+ したがって`config.public_file_server.enabled = true`を設定することは必須なのでは無いかとも思いますがいかがでしょうか?
6
12
 
7
13
 
8
14
 
@@ -60,7 +66,7 @@
60
66
 
61
67
  location ~ ^/assets/(.*) {
62
68
 
63
- alias http://puma_app/public/assets/$1;
69
+ proxy_pass http://puma_app;
64
70
 
65
71
  }
66
72
 
@@ -98,6 +104,6 @@
98
104
 
99
105
  ` location ~ ^/assets/(.*) {
100
106
 
101
- alias http://puma_app/public/assets/$1;
107
+ proxy_pass http://puma_app;
102
108
 
103
109
  }`