teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

nginx設定ファイルを記載

2020/07/30 09:32

投稿

koki0502
koki0502

スコア19

title CHANGED
File without changes
body CHANGED
@@ -93,6 +93,61 @@
93
93
  });
94
94
  ```
95
95
 
96
+ nginx設定ファイル
97
+ *.conf
98
+ ```conf
99
+ error_log /var/www/rails/*/log/nginx.error.log;
100
+ access_log /var/www/rails/*/log/nginx.access.log;
101
+
102
+ upstream unicorn_server {
103
+ server unix:/var/www/rails/*/tmp/sockets/.unicorn.sock fail_timeout=0;
104
+ }
105
+
106
+ server {
107
+ listen 80;
108
+ client_max_body_size 4G;
109
+ server_name www.*.co.jp *.co.jp;
110
+
111
+ # webサーバとクライアントの通信時にHTTP通信をタイムアウトせずに待つ秒数
112
+ keepalive_timeout 5;
113
+
114
+ # Location of our static files
115
+ root /var/www/rails/*/public; #自分のアプリケーション名に変更
116
+
117
+ location ~ ^/assets/ {
118
+ root /var/www/rails/*/public; #自分のアプリケーション名に変更
119
+ }
120
+
121
+ location / {
122
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
123
+ proxy_set_header Host $http_host;
124
+ proxy_redirect off;
125
+
126
+ if (!-f $request_filename) {
127
+ proxy_pass http://unicorn_server;
128
+ break;
129
+ }
130
+ }
131
+
132
+
133
+ location /cable {
134
+ proxy_pass http://unicorn_server/cable;
135
+ proxy_http_version 1.1;
136
+ proxy_set_header Upgrade websocket;
137
+ proxy_set_header Connection Upgrade;
138
+ proxy_set_header X-Real-IP $remote_addr;
139
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
140
+ proxy_set_header X-Forwarded-Proto https;
141
+ }
142
+
143
+
144
+ error_page 500 502 503 504 /500.html;
145
+ location = /500.html {
146
+ root /var/www/rails/*/public; #自分のアプリケーション名に変更
147
+ }
148
+ }
149
+ ```
150
+
96
151
  log/production.log の該当範囲をみてもエラーなどはないように見受けました。
97
152
 
98
153
  些細なことでも結構ですので、思い当たる点などございましたらご教示頂けますと幸いです。

2

コード記載ミス修正

2020/07/30 09:32

投稿

koki0502
koki0502

スコア19

title CHANGED
File without changes
body CHANGED
@@ -63,7 +63,7 @@
63
63
  end
64
64
 
65
65
  def post(data)
66
- ActionCable.server.broadcast('chat_channel', data)
66
+ ActionCable.server.broadcast('function_channel', data)
67
67
  end
68
68
 
69
69
  end

1

コードのペーストミスを修正

2020/07/30 09:00

投稿

koki0502
koki0502

スコア19

title CHANGED
File without changes
body CHANGED
@@ -45,7 +45,7 @@
45
45
  console.log(button);
46
46
 
47
47
  button.addEventListener('click', function () {
48
- App.chat.post("hoge");
48
+ App.function.post("hoge");
49
49
  });
50
50
  console.log("準備完了");
51
51
  </script>
@@ -72,7 +72,7 @@
72
72
  ActionCable実装に使用するjsファイル
73
73
 
74
74
  ```
75
- App.chat = App.cable.subscriptions.create("ChatChannel", {
75
+ App.function = App.cable.subscriptions.create("functionChannel", {
76
76
  connected: function() {
77
77
  // Called when the subscription is ready for use on the server
78
78
  },