質問編集履歴

5

unicornのエラー

2020/01/08 23:33

投稿

odennkunn
odennkunn

スコア16

test CHANGED
File without changes
test CHANGED
@@ -221,3 +221,41 @@
221
221
  2020/01/08 13:23:06 [error] 3288#0: *19 open() "/usr/share/nginx/html/latest/dynamic/instance-identity/document" failed (2: No such file or directory), client: 44.224.22.196, server: localhost, request: "GET /latest/dynamic/instance-identity/document HTTP/1.1", host: "[::ffff:a9fe:a9fe]"
222
222
 
223
223
  ```
224
+
225
+
226
+
227
+ ターミナルでbundle exec unicorn_rails -c config/unicorn.rb -E production -Dを実行すると
228
+
229
+ ```
230
+
231
+ bundler: failed to load command: unicorn_rails (/home/ec2-user/.rbenv/versions/2.5.1/bin/unicorn_rails)
232
+
233
+ ArgumentError: config_file=config/unicorn.rb would not be accessible in working_directory=/var/www/current
234
+
235
+ /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:592:in `working_directory'
236
+
237
+ config/unicorn.rb:8:in `reload'
238
+
239
+ /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:84:in `instance_eval'
240
+
241
+ /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:84:in `reload'
242
+
243
+ /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:77:in `initialize'
244
+
245
+ /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:77:in `new'
246
+
247
+ /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:77:in `initialize'
248
+
249
+ /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `new'
250
+
251
+ /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `<top (required)>'
252
+
253
+ /home/ec2-user/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `load'
254
+
255
+ /home/ec2-user/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `<top (required)>'
256
+
257
+ master failed to start, check stderr log for details
258
+
259
+ ```
260
+
261
+ と出て起動ができない状態になっています。

4

本文修正

2020/01/08 23:33

投稿

odennkunn
odennkunn

スコア16

test CHANGED
File without changes
test CHANGED
@@ -10,6 +10,10 @@
10
10
 
11
11
  使用しているのはAWS EC2、Unicorn、MySQLです
12
12
 
13
+ unicornを確認したところ、現在は起動ができず、これが原因だと思われます。
14
+
15
+
16
+
13
17
 
14
18
 
15
19
  /etc/nginx/conf.d/rails.conf

3

タイトル修正

2020/01/08 23:29

投稿

odennkunn
odennkunn

スコア16

test CHANGED
@@ -1 +1 @@
1
- 本番環境でnginxのデフォルトページが表示されてしまう
1
+ unicornが起動できず、本番環境でnginxのデフォルトページが表示されてしまう
test CHANGED
File without changes

2

errorlog

2020/01/08 23:18

投稿

odennkunn
odennkunn

スコア16

test CHANGED
File without changes
test CHANGED
@@ -195,3 +195,25 @@
195
195
  }
196
196
 
197
197
  ```
198
+
199
+ nginx errorlog
200
+
201
+ ```
202
+
203
+ 2020/01/08 07:23:34 [error] 13634#0: *5434 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 124.18.104.11, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "lifehacksharing.com", referrer: "http://lifehacksharing.com/"
204
+
205
+ 2020/01/08 11:10:56 [error] 3154#0: *7 connect() to unix:/var/www/lifehacksharing/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 139.162.106.181, server: 3.114.134.212, request: "GET / HTTP/1.1", upstream: "http://unix:/var/www/lifehacksharing/shared/tmp/sockets/unicorn.sock:/", host: "3.114.134.212"
206
+
207
+ 2020/01/08 11:12:19 [error] 3154#0: *9 connect() to unix:/var/www/lifehacksharing/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 206.81.24.102, server: 3.114.134.212, request: "GET / HTTP/1.1", upstream: "http://unix:/var/www/lifehacksharing/shared/tmp/sockets/unicorn.sock:/", host: "3.114.134.212"
208
+
209
+ 2020/01/08 11:31:34 [error] 3154#0: *16 connect() to unix:/var/www/lifehacksharing/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 34.90.133.193, server: 3.114.134.212, request: "OPTIONS / HTTP/1.0", upstream: "http://unix:/var/www/lifehacksharing/shared/tmp/sockets/unicorn.sock:/", host: "3.114.134.212"
210
+
211
+ 2020/01/08 13:23:05 [error] 3288#0: *13 open() "/usr/share/nginx/html/latest/dynamic/instance-identity/document" failed (2: No such file or directory), client: 44.224.22.196, server: localhost, request: "GET http://169.254.169.254/latest/dynamic/instance-identity/document HTTP/1.1", host: "169.254.169.254"
212
+
213
+ 2020/01/08 13:23:05 [error] 3288#0: *14 open() "/usr/share/nginx/html/latest/dynamic/instance-identity/document" failed (2: No such file or directory), client: 44.224.22.196, server: localhost, request: "GET http://[::ffff:a9fe:a9fe]/latest/dynamic/instance-identity/document HTTP/1.1", host: "[::ffff:a9fe:a9fe]"
214
+
215
+ 2020/01/08 13:23:06 [error] 3288#0: *18 open() "/usr/share/nginx/html/latest/dynamic/instance-identity/document" failed (2: No such file or directory), client: 44.224.22.196, server: localhost, request: "GET /latest/dynamic/instance-identity/document HTTP/1.1", host: "169.254.169.254"
216
+
217
+ 2020/01/08 13:23:06 [error] 3288#0: *19 open() "/usr/share/nginx/html/latest/dynamic/instance-identity/document" failed (2: No such file or directory), client: 44.224.22.196, server: localhost, request: "GET /latest/dynamic/instance-identity/document HTTP/1.1", host: "[::ffff:a9fe:a9fe]"
218
+
219
+ ```

1

nginx.conf

2020/01/08 14:28

投稿

odennkunn
odennkunn

スコア16

test CHANGED
File without changes
test CHANGED
@@ -75,3 +75,123 @@
75
75
  }
76
76
 
77
77
  ```
78
+
79
+ ```
80
+
81
+ user nginx;
82
+
83
+ worker_processes auto;
84
+
85
+ error_log /var/log/nginx/error.log;
86
+
87
+ pid /var/run/nginx.pid;
88
+
89
+
90
+
91
+ Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
92
+
93
+ include /usr/share/nginx/modules/*.conf;
94
+
95
+
96
+
97
+ events {
98
+
99
+ worker_connections 1024;
100
+
101
+ }
102
+
103
+
104
+
105
+ http {
106
+
107
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
108
+
109
+ '$status $body_bytes_sent "$http_referer" '
110
+
111
+ '"$http_user_agent" "$http_x_forwarded_for"';
112
+
113
+
114
+
115
+ access_log /var/log/nginx/access.log main;
116
+
117
+
118
+
119
+ sendfile on;
120
+
121
+ tcp_nopush on;
122
+
123
+ tcp_nodelay on;
124
+
125
+ keepalive_timeout 65;
126
+
127
+ types_hash_max_size 2048;
128
+
129
+
130
+
131
+ include /etc/nginx/mime.types;
132
+
133
+ default_type application/octet-stream;
134
+
135
+
136
+
137
+ # Load modular configuration files from the /etc/nginx/conf.d directory.
138
+
139
+ # See http://nginx.org/en/docs/ngx_core_module.html#include
140
+
141
+ # for more information.
142
+
143
+ include /etc/nginx/conf.d/*.conf;
144
+
145
+
146
+
147
+ index index.html index.htm;
148
+
149
+
150
+
151
+ server {
152
+
153
+ listen 80 default_server;
154
+
155
+ listen [::]:80 default_server;
156
+
157
+ server_name localhost;
158
+
159
+ root /usr/share/nginx/html;
160
+
161
+
162
+
163
+ # Load configuration files for the default server block.
164
+
165
+ include /etc/nginx/default.d/*.conf;
166
+
167
+
168
+
169
+ location / {
170
+
171
+ }
172
+
173
+
174
+
175
+ # redirect server error pages to the static page /40x.html
176
+
177
+ #
178
+
179
+ error_page 404 /404.html;
180
+
181
+ location = /40x.html {
182
+
183
+ }
184
+
185
+
186
+
187
+ # redirect server error pages to the static page /50x.html
188
+
189
+ #
190
+
191
+ error_page 500 502 503 504 /50x.html;
192
+
193
+ location = /50x.html {
194
+
195
+ }
196
+
197
+ ```