質問編集履歴

6

secret_key_base のエラーに関して追記

2017/03/21 13:22

投稿

konake15
konake15

スコア11

test CHANGED
File without changes
test CHANGED
@@ -341,3 +341,55 @@
341
341
  E, [2017-03-21T17:50:24.306012 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/bin/unicorn:23:in `<main>'
342
342
 
343
343
  ```
344
+
345
+
346
+
347
+ ###追記2 secret_key_base のエラーに関して
348
+
349
+ アプリのconfig/deploy.rbにて、
350
+
351
+ ```
352
+
353
+
354
+
355
+ set :linked_files, fetch(:linked_files, []).push('config/settings.yml')
356
+
357
+
358
+
359
+ ```
360
+
361
+
362
+
363
+ と書いた後、`/var/www/introduction/shared/config/settings.yml`に
364
+
365
+ ```
366
+
367
+ production:
368
+
369
+ secret_key_base: ~~~
370
+
371
+ ```
372
+
373
+ を記入し、デプロイをしましたが、
374
+
375
+ ```
376
+
377
+ Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml` (RuntimeError)
378
+
379
+ ```
380
+
381
+ が発生したままです。
382
+
383
+
384
+
385
+ ###追記2に関して試したこと
386
+
387
+ ・デプロイ後のsecrets.ymlに直接記入
388
+
389
+ ・`export SECRET_KEY_BASE=〜〜〜`
390
+
391
+ ・`~/.bashrc`と`~/.bash_profile`の中に`export SECRET_KEY_BASE=〜〜〜`を記入
392
+
393
+
394
+
395
+ `echo $SECRET_KEY_BASE`を実行するとターミナル上では表示されるのですが、unicornをリスタートさせても同じエラーのままでした。

5

/etc/nginx/conf\.d/introduction\.confの設定を修正後のエラーを追記

2017/03/21 13:22

投稿

konake15
konake15

スコア11

test CHANGED
File without changes
test CHANGED
@@ -295,3 +295,49 @@
295
295
  end
296
296
 
297
297
  ```
298
+
299
+
300
+
301
+ ###追記 /etc/nginx/conf.d/introduction.confの設定を修正した結果
302
+
303
+ 「このページは動作していません
304
+
305
+ www.ateam17-introduce.xyz では現在このリクエストを処理できません。
306
+
307
+ HTTP ERROR 500」
308
+
309
+ と表示されました。
310
+
311
+ unicorn.logには以下のように表示されました。
312
+
313
+
314
+
315
+ ```
316
+
317
+ E, [2017-03-21T17:50:24.305630 #20611] ERROR -- : app error: Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml` (RuntimeError)
318
+
319
+ E, [2017-03-21T17:50:24.305755 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:513:in `validate_secret_key_config!'
320
+
321
+ E, [2017-03-21T17:50:24.305791 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:246:in `env_config'
322
+
323
+ E, [2017-03-21T17:50:24.305816 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:693:in `build_request'
324
+
325
+ E, [2017-03-21T17:50:24.305840 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:521:in `build_request'
326
+
327
+ E, [2017-03-21T17:50:24.305862 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:521:in `call'
328
+
329
+ E, [2017-03-21T17:50:24.305884 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:562:in `process_client'
330
+
331
+ E, [2017-03-21T17:50:24.305905 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:658:in `worker_loop'
332
+
333
+ E, [2017-03-21T17:50:24.305922 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:508:in `spawn_missing_workers'
334
+
335
+ E, [2017-03-21T17:50:24.305943 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:132:in `start'
336
+
337
+ E, [2017-03-21T17:50:24.305957 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/gems/unicorn-5.2.0/bin/unicorn:126:in `<top (required)>'
338
+
339
+ E, [2017-03-21T17:50:24.305975 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/bin/unicorn:23:in `load'
340
+
341
+ E, [2017-03-21T17:50:24.306012 #20611] ERROR -- : /var/www/introduction/shared/bundle/ruby/2.3.0/bin/unicorn:23:in `<main>'
342
+
343
+ ```

4

その他ファイルの修正

2017/03/21 10:19

投稿

konake15
konake15

スコア11

test CHANGED
File without changes
test CHANGED
@@ -160,7 +160,7 @@
160
160
 
161
161
 
162
162
 
163
- ###そのほかの設定ファイル
163
+ ###そのの設定ファイル
164
164
 
165
165
  `/etc/nginx/conf.d/introduction.conf` は以下のように設定してあります。
166
166
 
@@ -186,7 +186,7 @@
186
186
 
187
187
  listen 80;
188
188
 
189
- server_name 13.113.68.~~~;
189
+ server_name 127.0.0.1;
190
190
 
191
191
  keepalive_timeout 5;
192
192
 

3

設定ファイルの追記

2017/03/20 00:34

投稿

konake15
konake15

スコア11

test CHANGED
File without changes
test CHANGED
@@ -157,3 +157,141 @@
157
157
  current 777
158
158
 
159
159
  でした。
160
+
161
+
162
+
163
+ ###そのほかの設定ファイル
164
+
165
+ `/etc/nginx/conf.d/introduction.conf` は以下のように設定してあります。
166
+
167
+ ```
168
+
169
+ error_log /var/www/introduction/current/log/nginx.error.log;
170
+
171
+ access_log /var/www/introduction/current/log/nginx.access.log;
172
+
173
+
174
+
175
+ client_max_body_size 2G;
176
+
177
+ upstream app_server {
178
+
179
+ server unix:/var/www/introduction/current/tmp/sockets/.unicorn.sock fail_timeout=0;
180
+
181
+ }
182
+
183
+
184
+
185
+ server {
186
+
187
+ listen 80;
188
+
189
+ server_name 13.113.68.~~~;
190
+
191
+ keepalive_timeout 5;
192
+
193
+ root /var/www/introduction/current/public;
194
+
195
+
196
+
197
+ try_files $uri/index.html $uri.html $uri @app;
198
+
199
+
200
+
201
+ location @app {
202
+
203
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
204
+
205
+ proxy_set_header Host $http_host;
206
+
207
+ proxy_redirect off;
208
+
209
+ proxy_pass http://app_server;
210
+
211
+ }
212
+
213
+
214
+
215
+ error_page 500 502 503 504 /500.html;
216
+
217
+ location = /500.html {
218
+
219
+ root /var/www/introduction/current/public;
220
+
221
+ }
222
+
223
+ }
224
+
225
+ ```
226
+
227
+ またunicornnの方は、`/var/www/introduction/current/config/unicorn`にて、以下のように設定されています。
228
+
229
+ ```
230
+
231
+ $worker = 2
232
+
233
+ $timeout = 30
234
+
235
+
236
+
237
+ $app_dir = "/var/www/introduction/current"
238
+
239
+
240
+
241
+ $listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir
242
+
243
+ $pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir
244
+
245
+ $std_log = File.expand_path 'log/unicorn.log', $app_dir
246
+
247
+
248
+
249
+ worker_processes $worker
250
+
251
+ working_directory $app_dir
252
+
253
+ stderr_path $std_log
254
+
255
+ stdout_path $std_log
256
+
257
+ timeout $timeout
258
+
259
+ listen $listen
260
+
261
+ pid $pid
262
+
263
+
264
+
265
+ preload_app true
266
+
267
+
268
+
269
+ before_fork do |server, worker|
270
+
271
+ defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
272
+
273
+ old_pid = "#{server.config[:pid]}.oldbin"
274
+
275
+ if old_pid != server.pid
276
+
277
+ begin
278
+
279
+ Process.kill "QUIT", File.read(old_pid).to_i
280
+
281
+ rescue Errno::ENOENT, Errno::ESRCH
282
+
283
+ end
284
+
285
+ end
286
+
287
+ end
288
+
289
+
290
+
291
+ after_fork do |server, worker|
292
+
293
+ defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
294
+
295
+ end
296
+
297
+ ```

2

エラーメッセージに関して追記

2017/03/20 00:30

投稿

konake15
konake15

スコア11

test CHANGED
File without changes
test CHANGED
@@ -134,6 +134,16 @@
134
134
 
135
135
  ```
136
136
 
137
+ エラーメッセージは
138
+
139
+ ```
140
+
141
+ `2017/03/18 09:41:08 [error] 6367#0: *92 directory index of "/var/www/introduction/current/public/" is forbidden, client: 60.135.210.91, server: localhost, request: "GET / HTTP/1.1", host: "www.(省略)"`
142
+
143
+ ```
144
+
145
+ となっております。
146
+
137
147
 
138
148
 
139
149
  パーミッションは、`/var/www/introduction/current/public`で

1

ファイルのパーミッションに関して追記

2017/03/18 10:25

投稿

konake15
konake15

スコア11

test CHANGED
File without changes
test CHANGED
@@ -133,3 +133,17 @@
133
133
  }
134
134
 
135
135
  ```
136
+
137
+
138
+
139
+ パーミッションは、`/var/www/introduction/current/public`で
140
+
141
+ var 755
142
+
143
+ www 755
144
+
145
+ introduction 755
146
+
147
+ current 777
148
+
149
+ でした。