Socket.io w/ node.js + nginx +mysql + php5-fpm Memory Leak?

I have a Debian VPS running node.js socket.io server + nginx + mysql +php5-fpm and the socket server seems to freeze with no messages and no errors. I noticed that the memory usage grows over time but can’t seem to find the reason. I kept track of memory usage with ‘top’ command and that’s what … Read more

Deployment of node js app listening on two separate ports under nginx

I have a simple node.js app that listens to two ports: on 8001 it sets up a simple webserver by doing var express = require(‘express’); var gHttpApp = express(); gHttpApp.use(express.static(‘public’)); gHttpApp.listen(8080, function () { console.log(‘HTTP Server listening on *:8001’); }); Then, on 8002 it sets up socket.io var io = require(‘socket.io’)(); gSocket = io.listen(8002); In … Read more

Nginx + Socket.io + Proxy

After reading several articles, I’m still unable to get my socket.io communication working via a nginx proxy. Below is my nginx configuration: map $http_upgrade $connection_upgrade { default upgrade; ” close; } location ~* \.io { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection ‘upgrade’; } Here’s how my node.js express server is wired up: … Read more

How to distribute socket.io servers globally?

We have a Socket.io service that needs constant communication with Mongodb. We currently have a load balancer server, 16 containers in a server (due to nodejs being single threaded, we split processes by dockers so we can utilize entire server) and a MongoDB server. We aren’t in production yet so we didn’t create a replication … Read more

Why is my Nginx-Socket.io-Express-Setup not working over HTTPS?

Locally it is working perfectly but as soon as I put it behind the Nginx reverse-proxy I get this in the Chrome Developer Console: GET https://127.0.0.1:8443/socket.io/?EIO=3&transport=polling&t=MoHVP61 net::ERR_SSL_PROTOCOL_ERROR Nginx configuration: upstream io_nodes { ip_hash; server 127.0.0.1:8443; } map $sent_http_content_type $expires { default off; text/html epoch; text/css max; application/javascript max; ~image/ max; } server { listen 80; … Read more

NGINX deny all except websockets for Flask app

I have an Ubuntu server running Flask app under nginx, this is my conf: upstream flaskapp { server 127.0.0.1:5000 fail_timeout=0; } server { listen 80; server_name _; location / { add_header “Access-Control-Allow-Origin” “http://localhost, https://website”; try_files $uri @proxy_to_app; } location @proxy_to_app { proxy_pass http://flaskapp; proxy_http_version 1.1; proxy_buffering off; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection “Upgrade”; proxy_set_header X-Forwarded-For … Read more

Deploy Laravel and Socket IO into Nginx

I’ve deployed my Laravel project that using socket io on nginx here is the server spec : NAME=”CentOS Linux” VERSION=”7 (Core)” ID=”centos” ID_LIKE=”rhel fedora” VERSION_ID=”7″ PRETTY_NAME=”CentOS Linux 7 (Core)” ANSI_COLOR=”0;31″ CPE_NAME=”cpe:/o:centos:centos:7″ HOME_URL=”https://www.centos.org/” BUG_REPORT_URL=”https://bugs.centos.org/” CENTOS_MANTISBT_PROJECT=”CentOS-7″ CENTOS_MANTISBT_PROJECT_VERSION=”7″ REDHAT_SUPPORT_PRODUCT=”centos” REDHAT_SUPPORT_PRODUCT_VERSION=”7″ here is my config file : server { listen 443 ssl; server_name website.tld; proxy_pass_header Server; proxy_buffering off; server_tokens … Read more

How to run socket.io on domain?

How do I run socket.io on a domain because my code works on localhost but not on a domain? I am currently running the server on http://localhost:3000, does this have to be public in some way so that it can be used from anywhere? Please help. Thanks Script.js (client-side) const socket = io(“http://localhost:3000”); const messageContainer … Read more