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.
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;
}