{"id":13826114,"url":"https://github.com/robzhu/nginx-local-tunnel","last_synced_at":"2026-01-26T22:31:29.575Z","repository":{"id":44487169,"uuid":"200288400","full_name":"robzhu/nginx-local-tunnel","owner":"robzhu","description":"A docker container that redirects incoming HTTP traffic to a local port for reverse SSH tunneling","archived":false,"fork":false,"pushed_at":"2022-12-11T01:21:02.000Z","size":664,"stargazers_count":22,"open_issues_count":6,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-05T09:14:54.060Z","etag":null,"topics":["docker","letsencrypt","lightsail","nginx","ssh","webdevelopment"],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","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/robzhu.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}},"created_at":"2019-08-02T19:35:46.000Z","updated_at":"2024-04-19T19:57:49.000Z","dependencies_parsed_at":"2023-01-26T13:32:09.398Z","dependency_job_id":null,"html_url":"https://github.com/robzhu/nginx-local-tunnel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robzhu%2Fnginx-local-tunnel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robzhu%2Fnginx-local-tunnel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robzhu%2Fnginx-local-tunnel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robzhu%2Fnginx-local-tunnel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robzhu","download_url":"https://codeload.github.com/robzhu/nginx-local-tunnel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225470636,"owners_count":17479366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["docker","letsencrypt","lightsail","nginx","ssh","webdevelopment"],"created_at":"2024-08-04T09:01:32.297Z","updated_at":"2026-01-26T22:31:29.543Z","avatar_url":"https://github.com/robzhu.png","language":"Dockerfile","funding_links":[],"categories":["\u003ca id=\"01e6651181d405ecdcd92a452989e7e0\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"9d6789f22a280f5bb6491d1353b02384\"\u003e\u003c/a\u003e隧道\u0026\u0026穿透"],"readme":"# nginx-local-tunnel\n\nThis container lets you access an app running on localhost from a remote URL with SSL termination. This is helpful for testing integrations that require SSL, such as PWAs, Alexa Skills, Github WebHooks, etc. If you've ever used ngrok or serveo, this is just like that but with a little more control.\n\n![diagram](/diagram.png?raw=true \"Diagram\")\n\n# Instructions\n\n## 0. Launch a Host Instance\n\nLaunch an Ubuntu 18.04 Virtual Private Server using any provider and open port 80. On the server, [install docker](https://docs.docker.com/install/). Configure DNS to point your domain to your host server's IP.\n\n## 1. Build the container image\n\n```bash\ngit clone https://github.com/robzhu/nginx-local-tunnel\ncd nginx-local-tunnel\n\ndocker build -t {DOCKERUSER}/dev-proxy . --build-arg ROOTPW={PASSWORD}\n\n# launch the container\ndocker run -d -P 80:80 -p 2222:22 {DOCKERUSER}/dev-proxy\n```\n\n## 2. On your dev machine, create a reverse tunnel with SSH\n\n```bash\n# Ports explained:\n# 3000 refers to the port that your app is running on localhost.\n# 2222 is the forwarded port on the host that we use to directly SSH into the container.\n# 80 is the default HTTP port, forwarded from the host\nssh -R :80:localhost:3000 -p 2222 root@YOURDOMAIN.tld\n```\n\n## 3. Start the sample app on localhost\n\n```bash\ncd node-hello \u0026\u0026 npm i\nnodemon main.js\n```\n\nNow you should be able to access your app from either http://localhost:3000 or http://YOURDOMAIN.com.\n\n# SSL\n\nOn the server, launch [nginx-proxy](https://github.com/jwilder/nginx-proxy) and [docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion), then launch your container, specifying the subdomain.\n\n```bash\ndocker run --detach \\\n    --name nginx-proxy \\\n    --publish 80:80 \\\n    --publish 443:443 \\\n    --volume /etc/nginx/certs \\\n    --volume /etc/nginx/vhost.d \\\n    --volume /usr/share/nginx/html \\\n    --volume /var/run/docker.sock:/tmp/docker.sock:ro \\\n    jwilder/nginx-proxy\n\ndocker run --detach \\\n    --name nginx-proxy-letsencrypt \\\n    --volumes-from nginx-proxy \\\n    --volume /var/run/docker.sock:/var/run/docker.sock:ro \\\n    --env \"DEFAULT_EMAIL={YOUREMAIL}\" \\\n    jrcs/letsencrypt-nginx-proxy-companion\n\ndocker run --detach \\\n    --name dev-proxy \\\n    --publish 2222:22 \\\n    --env \"VIRTUAL_HOST=dev.YOURDOMAIN.tld\" \\\n    --env \"LETSENCRYPT_HOST=dev.YOURDOMAIN.tld\" \\\n    {DOCKERUSER}/dev-proxy\n\n```\n\nOn your local dev machine:\n\n```bash\nssh -NR :80:localhost:3000 -p 2222 root@YOURDOMAIN.tld\n# run something on localhost:3000\n```\n\nAs long as you keep this SSH connection open, you'll able to access your app from either http://localhost:3000 or https://dev.YOURDOMAIN.tld. For additional security, you'll want to limit access to only a select set of IP addresses and origins.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobzhu%2Fnginx-local-tunnel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobzhu%2Fnginx-local-tunnel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobzhu%2Fnginx-local-tunnel/lists"}