質問編集履歴
2
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -30,4 +30,78 @@
|
|
30
30
|
nginx.error.logの内容↓
|
31
31
|
|
32
32
|
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アドレス"
|
33
|
-
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"
|
33
|
+
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"
|
34
|
+
|
35
|
+
unicornの設定
|
36
|
+
unicorn.conf.rb↓
|
37
|
+
```
|
38
|
+
# set lets
|
39
|
+
$worker = 2
|
40
|
+
$timeout = 30
|
41
|
+
$app_dir = "/var/www/rails/アプリ名"
|
42
|
+
$listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir
|
43
|
+
$pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir
|
44
|
+
$std_log = File.expand_path 'log/unicorn.log', $app_dir
|
45
|
+
# set config
|
46
|
+
worker_processes $worker
|
47
|
+
working_directory $app_dir
|
48
|
+
stderr_path $std_log
|
49
|
+
stdout_path $std_log
|
50
|
+
timeout $timeout
|
51
|
+
listen $listen
|
52
|
+
pid $pid
|
53
|
+
# loading booster
|
54
|
+
preload_app true
|
55
|
+
# before starting processes
|
56
|
+
before_fork do |server, worker|
|
57
|
+
defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
|
58
|
+
old_pid = "#{server.config[:pid]}.oldbin"
|
59
|
+
if old_pid != server.pid
|
60
|
+
begin
|
61
|
+
Process.kill "QUIT", File.read(old_pid).to_i
|
62
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
# after finishing processes
|
67
|
+
after_fork do |server, worker|
|
68
|
+
defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
|
69
|
+
end
|
70
|
+
|
71
|
+
```
|
72
|
+
nginxの設定
|
73
|
+
アプリ名.conf↓
|
74
|
+
```ここに言語を入力
|
75
|
+
# log directory
|
76
|
+
error_log /var/www/rails/アプリ名/log/nginx.error.log;
|
77
|
+
access_log /var/www/rails/アプリ名/log/nginx.access.log;
|
78
|
+
# max body size
|
79
|
+
client_max_body_size 2G;
|
80
|
+
upstream app_server {
|
81
|
+
# for UNIX domain socket setups
|
82
|
+
server unix:/var/www/rails/アプリ名/tmp/sockets/.unicorn.sock fail_timeout=0;
|
83
|
+
}
|
84
|
+
server {
|
85
|
+
listen 80;
|
86
|
+
server_name IPアドレス;
|
87
|
+
# nginx so increasing this is generally safe...
|
88
|
+
keepalive_timeout 5;
|
89
|
+
# path for static files
|
90
|
+
root /var/www/rails/アプリ名/public;
|
91
|
+
# page cache loading
|
92
|
+
try_files $uri/index.html $uri.html $uri @app;
|
93
|
+
location @app {
|
94
|
+
# HTTP headers
|
95
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
96
|
+
proxy_set_header Host $http_host;
|
97
|
+
proxy_redirect off;
|
98
|
+
proxy_pass http://app_server;
|
99
|
+
}
|
100
|
+
# Rails error pages
|
101
|
+
error_page 500 502 503 504 /500.html;
|
102
|
+
location = /500.html {
|
103
|
+
root /var/www/rails/アプリ名/public;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
```
|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -23,4 +23,11 @@
|
|
23
23
|
unicorn v5.2.0
|
24
24
|
mysql 5.5.56
|
25
25
|
|
26
|
-
初学者ですが何卒宜しくお願いします。
|
26
|
+
初学者ですが何卒宜しくお願いします。
|
27
|
+
|
28
|
+
追記
|
29
|
+
|
30
|
+
nginx.error.logの内容↓
|
31
|
+
|
32
|
+
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アドレス"
|
33
|
+
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"
|