質問編集履歴

2

追記

2017/07/26 02:58

投稿

nk117
nk117

スコア31

test CHANGED
File without changes
test CHANGED
@@ -63,3 +63,151 @@
63
63
  2017/07/25 04:15:20 [error] 2965#0: *3 connect() to unix:/var/www/rails/アプリ名/tmp/sockets/.unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 139.162.124.167, server: ipアドレス, request: "GET / HTTP/1.1", upstream: "http://unix:/var/www/rails/アプリ名/tmp/sockets/.unicorn.sock:/", host: "ipアドレス"
64
64
 
65
65
  2017/07/25 23:41:18 [error] 29018#0: *33 open() "/usr/share/nginx/html/phpmyadmin/scripts/setup.php" failed (2: No such file or directory), client: 191.96.249.136, server: localhost, request: "GET /phpmyadmin/scripts/setup.php HTTP/1.0"
66
+
67
+
68
+
69
+ unicornの設定
70
+
71
+ unicorn.conf.rb↓
72
+
73
+ ```
74
+
75
+ # set lets
76
+
77
+ $worker = 2
78
+
79
+ $timeout = 30
80
+
81
+ $app_dir = "/var/www/rails/アプリ名"
82
+
83
+ $listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir
84
+
85
+ $pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir
86
+
87
+ $std_log = File.expand_path 'log/unicorn.log', $app_dir
88
+
89
+ # set config
90
+
91
+ worker_processes $worker
92
+
93
+ working_directory $app_dir
94
+
95
+ stderr_path $std_log
96
+
97
+ stdout_path $std_log
98
+
99
+ timeout $timeout
100
+
101
+ listen $listen
102
+
103
+ pid $pid
104
+
105
+ # loading booster
106
+
107
+ preload_app true
108
+
109
+ # before starting processes
110
+
111
+ before_fork do |server, worker|
112
+
113
+ defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
114
+
115
+ old_pid = "#{server.config[:pid]}.oldbin"
116
+
117
+ if old_pid != server.pid
118
+
119
+ begin
120
+
121
+ Process.kill "QUIT", File.read(old_pid).to_i
122
+
123
+ rescue Errno::ENOENT, Errno::ESRCH
124
+
125
+ end
126
+
127
+ end
128
+
129
+ end
130
+
131
+ # after finishing processes
132
+
133
+ after_fork do |server, worker|
134
+
135
+ defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
136
+
137
+ end
138
+
139
+
140
+
141
+ ```
142
+
143
+ nginxの設定
144
+
145
+ アプリ名.conf↓
146
+
147
+ ```ここに言語を入力
148
+
149
+ # log directory
150
+
151
+ error_log /var/www/rails/アプリ名/log/nginx.error.log;
152
+
153
+ access_log /var/www/rails/アプリ名/log/nginx.access.log;
154
+
155
+ # max body size
156
+
157
+ client_max_body_size 2G;
158
+
159
+ upstream app_server {
160
+
161
+ # for UNIX domain socket setups
162
+
163
+ server unix:/var/www/rails/アプリ名/tmp/sockets/.unicorn.sock fail_timeout=0;
164
+
165
+ }
166
+
167
+ server {
168
+
169
+ listen 80;
170
+
171
+ server_name IPアドレス;
172
+
173
+ # nginx so increasing this is generally safe...
174
+
175
+ keepalive_timeout 5;
176
+
177
+ # path for static files
178
+
179
+ root /var/www/rails/アプリ名/public;
180
+
181
+ # page cache loading
182
+
183
+ try_files $uri/index.html $uri.html $uri @app;
184
+
185
+ location @app {
186
+
187
+ # HTTP headers
188
+
189
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
190
+
191
+ proxy_set_header Host $http_host;
192
+
193
+ proxy_redirect off;
194
+
195
+ proxy_pass http://app_server;
196
+
197
+ }
198
+
199
+ # Rails error pages
200
+
201
+ error_page 500 502 503 504 /500.html;
202
+
203
+ location = /500.html {
204
+
205
+ root /var/www/rails/アプリ名/public;
206
+
207
+ }
208
+
209
+ }
210
+
211
+
212
+
213
+ ```

1

追記

2017/07/26 02:58

投稿

nk117
nk117

スコア31

test CHANGED
File without changes
test CHANGED
@@ -49,3 +49,17 @@
49
49
 
50
50
 
51
51
  初学者ですが何卒宜しくお願いします。
52
+
53
+
54
+
55
+ 追記
56
+
57
+
58
+
59
+ nginx.error.logの内容↓
60
+
61
+
62
+
63
+ 2017/07/25 04:15:20 [error] 2965#0: *3 connect() to unix:/var/www/rails/アプリ名/tmp/sockets/.unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 139.162.124.167, server: ipアドレス, request: "GET / HTTP/1.1", upstream: "http://unix:/var/www/rails/アプリ名/tmp/sockets/.unicorn.sock:/", host: "ipアドレス"
64
+
65
+ 2017/07/25 23:41:18 [error] 29018#0: *33 open() "/usr/share/nginx/html/phpmyadmin/scripts/setup.php" failed (2: No such file or directory), client: 191.96.249.136, server: localhost, request: "GET /phpmyadmin/scripts/setup.php HTTP/1.0"