質問編集履歴

2

2017/11/13以下追加しました。

2017/12/12 05:49

投稿

kaji
kaji

スコア648

test CHANGED
File without changes
test CHANGED
@@ -31,3 +31,81 @@
31
31
 
32
32
 
33
33
  Rails 5.1.4
34
+
35
+
36
+
37
+ 2017/11/13以下追加しました。
38
+
39
+
40
+
41
+ nginx設定
42
+
43
+ /etc/nginx/conf.d/sample.conf
44
+
45
+ ```ここに言語を入力
46
+
47
+ upstream unicorn_sample_production {
48
+
49
+ server unix:/var/www/rails/sample/tmp/unicorn.sock;
50
+
51
+ }
52
+
53
+ server {
54
+
55
+ listen 80;
56
+
57
+ server_name sample.xxxxx.net;
58
+
59
+ root /var/www/rails/sample/public;
60
+
61
+ access_log /var/log/nginx/ruby_sample_access.log;
62
+
63
+ error_log /var/log/nginx/ruby_sample_error.log;
64
+
65
+ client_max_body_size 100m;
66
+
67
+ error_page 500 502 503 504 /500.html;
68
+
69
+ try_files $uri/index.html $uri @unicorn_server;
70
+
71
+ location @unicorn_server {
72
+
73
+ proxy_set_header X-Real-IP $remote_addr;
74
+
75
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
76
+
77
+ proxy_set_header Host $http_host;
78
+
79
+ proxy_pass http://unicorn_sample_production;
80
+
81
+ }
82
+
83
+ }
84
+
85
+
86
+
87
+ ```
88
+
89
+ unicorn設定
90
+
91
+ config/unicorn.rb
92
+
93
+ ```ここに言語を入力
94
+
95
+ rails_root = File.expand_path('../../', __FILE__)
96
+
97
+ worker_processes 2
98
+
99
+ working_directory rails_root
100
+
101
+ listen "#{rails_root}/tmp/unicorn.sock", :backlog => 64
102
+
103
+ pid "#{rails_root}/tmp/unicorn.pid"
104
+
105
+ stderr_path "#{rails_root}/log/unicorn_error.log"
106
+
107
+ stdout_path "#{rails_root}/log/unicorn.log"
108
+
109
+ listen 8084
110
+
111
+ ```

1

ジェクトは新規作成からパフォーマンス周りは何

2017/12/12 05:49

投稿

kaji
kaji

スコア648

test CHANGED
File without changes
test CHANGED
@@ -3,8 +3,6 @@
3
3
 
4
4
 
5
5
  railsをnginx-unicornで
6
-
7
- developmentで動かしたところキャッシュが効かないので重かったのですが、
8
6
 
9
7
  productionはロジックがメモリにキャッシュされるような構造(unicornを再起動しないとrb変更が反映されない)になっている感じがするので、
10
8
 
@@ -14,9 +12,11 @@
14
12
 
15
13
  初回アクセスが重いです。
16
14
 
17
- 一度ページにアクセスすると
15
+ 一度ページにアクセスすると以後速くなります。
18
16
 
17
+
18
+
19
- 基本的には新規作成から何もいじってません。
19
+ 基本的にプロジェクトは新規作成からパフォーマンス周りは何もいじってません。
20
20
 
21
21
  assetsファイルはコマンドで作成しています。
22
22