2

I am using private pub for one of my projects. Its working fine on localhost but when I deploy it on live server it giving following error:

Errno::ECONNREFUSED in CommentsController#new

Connection refused - connect(2) for "202.164.34.20" port 9292

Here is my private_pub.yml file content for local server:

development:
 server: "http://localhost:9292/faye/faye"
 secret_token: "secret"
test:
 server: "http://localhost:9292/faye/faye"
 secret_token: "secret"
production:
 server: "http://example.com/faye/faye"
 secret_token: "0378a6008f37cbd9c3390ce4069bb85f776d068f7b4885d6890f07066affde25"
 signature_expiration: 3600 # one hour

and for other server, here is the file content:

development:
 server: "http://202.164.34.20:9292/faye/faye"
 secret_token: "secret"
test:
 server: "http://202.164.34.20:9292/faye/faye"
 secret_token: "secret"
production:
 server: "http://localhost:9292/faye/faye"
 secret_token: "0378a6008f37cbd9c3390ce4069bb85f776d068f7b4885d6890f07066affde25"
 signature_expiration: 3600 # one hour

Now I need to deploy this on http://202.164.34.20:3001 url. please suggest.

Akhil Latta
  • 528
  • 5
  • 13

1 Answers1

1

localhost:9292 means it will bind to 127.0.0.0, if you want to access from public ip make sure to bind to your external ip or to 0.0.0.0. Although I would suggest to proxy it with nginx/apache so users can just connect to port 80

Example for nginx

 server {
  listen 80;
  server_name faye.yourdomain.com;
  access_log /var/log/nginx/faye.log;

  location /faye {
    proxy_pass http://127.0.0.1:9292;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_buffering off;
    proxy_redirect off;
    proxy_connect_timeout      90;
    proxy_send_timeout         90;
    proxy_read_timeout         90;
  }

}


map $http_upgrade $connection_upgrade {
    default Upgrade;
    ''      close;
}
Chris
  • 3,795
  • 3
  • 17
  • 23
  • Thanks for your answer. That means server url will be http://202.164.34.20/faye/faye ? But it doesnot seem to work. Please suggest what should be the actual url for server in this case. – Akhil Latta Jul 21 '15 at 05:40
  • in that case you need to change production server in private_pub.yml to http://202.164.34.20t/faye/faye. But you probably already are running a webserver on port 80? – Chris Aug 19 '15 at 09:49
  • Yes you are right with that. So is it conflicting with faye. what's the solution for that? – Akhil Latta Aug 24 '15 at 07:29
  • are you using nginx or apache webserver? – Chris Aug 24 '15 at 11:24
  • 1
    see my example above, so run your faye server on a subdomain that is pointing to 202.164.34.20. Install nginx and use my example config – Chris Aug 26 '15 at 06:58