{"id":23701167,"url":"https://github.com/gitfrandu4/load-balancer","last_synced_at":"2026-01-27T03:06:24.103Z","repository":{"id":211625175,"uuid":"424252859","full_name":"gitfrandu4/load-balancer","owner":"gitfrandu4","description":"Load Balancing Node.js Applications with NGINX and Docker","archived":false,"fork":false,"pushed_at":"2021-11-05T00:47:41.000Z","size":46,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-22T21:14:00.030Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitfrandu4.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-03T14:17:45.000Z","updated_at":"2022-02-20T02:13:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb9dadda-eed4-4d5c-a7d5-b94dc9842bbd","html_url":"https://github.com/gitfrandu4/load-balancer","commit_stats":null,"previous_names":["gitfrandu4/load-balancer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gitfrandu4/load-balancer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitfrandu4%2Fload-balancer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitfrandu4%2Fload-balancer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitfrandu4%2Fload-balancer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitfrandu4%2Fload-balancer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitfrandu4","download_url":"https://codeload.github.com/gitfrandu4/load-balancer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitfrandu4%2Fload-balancer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28798659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T01:07:07.743Z","status":"online","status_checked_at":"2026-01-27T02:00:07.755Z","response_time":168,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-30T09:32:24.450Z","updated_at":"2026-01-27T03:06:24.088Z","avatar_url":"https://github.com/gitfrandu4.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Load Balancing Node.js Applications with NGINX and Docker\n\n## Configuración 4 \n\n![img conf IV](images/image-20211103141437433.png)\n\nEjemplo de **server nodejs**:\n\n```javascript\nconst express = require('express')\nconst app = express()\n\nlet ejs = require('ejs') \nlet fs = require('fs')\n\nconst port = process.env.PORT\n\nlet objectSentFromServer = [...] \n\napp.get('/', (req, res) =\u003e {\n    fs.readFile(__dirname + '/index.html', 'utf-8', (err, html) =\u003e {\n      res.send(ejs.render(html, { objectSentFromServer: objectSentFromServer}))\n    })\n})\n\napp.listen(port, () =\u003e {\n  console.log(`Example app listening at http://localhost:${port}`)\n})\n```\n\n**Configuración nginx.conf - Load balancer**\n\n```javascript\nupstream node_cluster {\n    server server1:3000 weight=1;\n    server server2:3001 weight=1;\n    server server3:3002 weight=1;\n}\n\nserver {\n    listen 80;\n    server_name _;\n\n    location / {\n        proxy_read_timeout 300s;\n        proxy_connect_timeout 75s;\n\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header Host $http_host;\n        proxy_pass http://node_cluster/;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n    }\n}\n```\n\n```\nBuild images:\n\ndocker build -t node-app .\\node\\.  \ndocker build -t nginx-conf4 .\\nginx\\.  \n\nStart containers:\n\ndocker-compose up\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitfrandu4%2Fload-balancer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitfrandu4%2Fload-balancer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitfrandu4%2Fload-balancer/lists"}