我尝试使用 Iframely。我在我的服务器 ubuntu + nginx 上安装了自托管版本:[https://iframely.com/docs/host][1]
当我像这样启动节点时:
# node server
Iframely 运行良好,否则,我会收到 502 错误网关错误。
错误
日志中出现错误:
2016/01/25 06:06:58 [error] 13265#0: *4476 connect() failed (111: Connection refused) while connecting to upstream, client: xx:xx:xx:xx:xx:xx, server: iframely.custom.com, request: "GET /iframely?url=http://coub.com/view/2pc24rpb HTTP/1.1", upstream: "http://127.0.0.1:8061/iframely?url=http://coub.com/view/2pc24rpb", host: "iframely.custom.com"
当我尝试:
# curl -i 127.0.0.1:8061/iframely?url=http://coub.com/view/2pc24rpb
确认错误:
curl: (7) Failed to connect to 127.0.0.1 port 8061: Connection refused
我从节点开始,我知道也许node.js没有监听端口8061。
当我尝试:
netstat -pantu
我没有看到有问题的端口,但其他端口与另一个 node.js 应用程序使用的端口类似,运行完美:
tcp6 0 0 127.0.0.1:4567 127.0.0.1:60724 ESTABLISHED 12329/node
配置
我的主机配置:
upstream iframely.custom.com {
ip_hash;
server localhost:8061;
keepalive 8;
}
server {
listen 80;
listen [::]:80;
server_name iframely.custom.com;
root /usr/share/nginx/html/iframely.custom.com;
# Logs
access_log /var/log/iframely.access_log;
error_log /var/log/iframely.error_log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://iframely.custom.com/;
proxy_redirect off;
# Socket.IO Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# Exclude from the logs to avoid bloating when it's not available
include drop.conf;
}
我尝试将配置中的 localhost 更改为 127.0.0.1,但没有任何改变。
如何让 node.js 应用程序保持活动状态:我必须永远重新启动它吗?这可能是 ipv4 或 ipv6 的问题吗?
提前感谢您的任何帮助。jb