質問編集履歴
6
ログの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,6 +2,24 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
|
6
|
+
|
7
|
+
nginxのエラーログ
|
8
|
+
|
9
|
+
```
|
10
|
+
|
11
|
+
$ sudo less error.log-20171203
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
2017/12/03 11:00:19 [error] 1819#1819: *1 connect() to unix:/var/www/app/sample_app/shared/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 00.000.00.20, server: 150.11.111.111, request: "GET /sitemap.xml.gz HTTP/1.1", upstream: "http://unix:/var/www/app/sample_app/shared/sockets/unicorn.sock:/500.html", host: "sample_app.jp"
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
```
|
20
|
+
|
21
|
+
|
22
|
+
|
5
23
|
http://sample.jp/sitemap.xml.gz(一部変更しております)
|
6
24
|
|
7
25
|
|
5
詳細
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,6 +28,92 @@
|
|
28
28
|
|
29
29
|
nginxの設定は以下のようになっております。
|
30
30
|
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
$less etc/nginx/nginx.conf
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
user nginx;
|
42
|
+
|
43
|
+
worker_processes 1;
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
error_log /var/log/nginx/error.log warn;
|
48
|
+
|
49
|
+
pid /var/run/nginx.pid;
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
events {
|
56
|
+
|
57
|
+
worker_connections 1024;
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
http {
|
66
|
+
|
67
|
+
include /etc/nginx/mime.types;
|
68
|
+
|
69
|
+
default_type application/octet-stream;
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
74
|
+
|
75
|
+
'$status $body_bytes_sent "$http_referer" '
|
76
|
+
|
77
|
+
'"$http_user_agent" "$http_x_forwarded_for"';
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
access_log /var/log/nginx/access.log main;
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
sendfile on;
|
86
|
+
|
87
|
+
#tcp_nopush on;
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
keepalive_timeout 65;
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
gzip on;
|
96
|
+
|
97
|
+
gzip_vary on;
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
gzip_types text/plain image/png image/jpeg image/gif application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml text/css;
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
include /etc/nginx/conf.d/*.conf;
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
```
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
31
117
|
```
|
32
118
|
|
33
119
|
$ less /etc/nginx/conf.d/local.conf
|
4
参考リンクを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -216,6 +216,10 @@
|
|
216
216
|
|
217
217
|
参考になりそうなもの
|
218
218
|
|
219
|
+
|
220
|
+
|
221
|
+
・[この方と同じ悩みと思われます](https://stackoverflow.com/questions/34963529/how-can-i-serve-assets-in-public-that-are-not-part-of-the-asset-pipeline-with-p)
|
222
|
+
|
219
223
|
・[Rails(Apache+Unicorn)で、public以下のディレクトリの中身が404になる場合の解決策](https://qiita.com/y_minowa/items/5954907bb30c2ecb43f5)
|
220
224
|
|
221
225
|
・[Rails 4.2以降: Rails+Unicorn で、publicディレクトリの中身が404になる場合の解決策](https://qiita.com/Yinaura/items/d7dc3daefb5825aba474)
|
3
書式の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -114,7 +114,9 @@
|
|
114
114
|
|
115
115
|
|
116
116
|
|
117
|
-
|
117
|
+
config/environments/production.rb
|
118
|
+
|
119
|
+
```ruby
|
118
120
|
|
119
121
|
|
120
122
|
|
2
補足追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -110,6 +110,98 @@
|
|
110
110
|
|
111
111
|
|
112
112
|
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
```ruby:config/environments/production.rb
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
Rails.application.configure do
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
config.cache_classes = true
|
126
|
+
|
127
|
+
config.eager_load = true
|
128
|
+
|
129
|
+
config.consider_all_requests_local = false
|
130
|
+
|
131
|
+
config.action_controller.perform_caching = true
|
132
|
+
|
133
|
+
config.read_encrypted_secrets = true
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
# Disable serving static files from the `/public` folder by default since
|
138
|
+
|
139
|
+
# NGINX already handles this.
|
140
|
+
|
141
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
# Compress JavaScripts and CSS.
|
146
|
+
|
147
|
+
config.assets.js_compressor = :uglifier
|
148
|
+
|
149
|
+
# config.assets.css_compressor = :sass
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
154
|
+
|
155
|
+
config.serve_static_files = true
|
156
|
+
|
157
|
+
config.assets.compile = true
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
config.log_level = :debug
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
config.log_tags = [ :request_id ]
|
166
|
+
|
167
|
+
config.action_mailer.perform_caching = false
|
168
|
+
|
169
|
+
config.i18n.fallbacks = true
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
174
|
+
|
175
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
176
|
+
|
177
|
+
logger.formatter = config.log_formatter
|
178
|
+
|
179
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
config.active_record.dump_schema_after_migration = false
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
```
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
113
205
|
public/assetsにはアクセスできているようなので、該当のファイルをpublic/assetsに配置してしまえば解決できそうなのですが、nginxの勉強も兼ねて実現できたら幸いでございます。
|
114
206
|
|
115
207
|
大変お手数おかけしますが、わかる方いましたら助言のほどよろしくお願いいたします。
|
1
タグ追加
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|