如何配置NGROK固定TCP静态端口?将全局端口设为7788
Hey there, I’ve got you covered on setting up that fixed TCP port for ngrok. Let’s walk through what you need to do step by step:
Key Prerequisite: ngrok Plan Requirement
First off, you should know that free ngrok accounts don’t support fixed TCP ports—this is a feature reserved for Pro, Business, or Enterprise plans. So you’ll need to upgrade your account if you haven’t already to access reserved TCP ports.
Step 1: Reserve Your Fixed TCP Port (7788)
Once you’re on a paid plan:
- Log into your ngrok dashboard/console.
- Look for the "Reserved Addresses" or "Reserved TCP Ports" section (the exact wording might vary slightly).
- Create a new reserved TCP port, specifying
7788as the port number. Make note of the full remote address provided (it’ll look something like0.tcp.ngrok.io:7788).
Step 2: Configure ngrok to Use the Reserved Port
You have two easy ways to set this up:
Option 1: Command Line Directly
Run this command in your terminal, replacing the remote address with the one you reserved:
ngrok tcp 7788 --remote-addr tcp://0.tcp.ngrok.io:7788
Option 2: Using a Configuration File
If you prefer a reusable setup, create a ngrok.yml file with these contents (replace YOUR_AUTH_TOKEN with your actual ngrok auth token, and the remote address with your reserved one):
authtoken: YOUR_AUTH_TOKEN tunnels: fixed-tcp-7788: proto: tcp addr: 7788 remote_addr: 0.tcp.ngrok.io:7788
Then start ngrok with this config:
ngrok start fixed-tcp-7788
Step 3: Verify the Setup
After launching ngrok, check the output—you should see a line like:
tcp://0.tcp.ngrok.io:7788 -> localhost:7788
That means your fixed port is working correctly, and future launches will use this same port instead of generating a random one.
Quick Notes
- Make sure your ngrok auth token is properly configured (you can set it once with
ngrok config add-authtoken YOUR_AUTH_TOKENto avoid adding it to the config file every time). - If port 7788 is already reserved by another ngrok user, you’ll need to pick a different port—but if it’s available, you’ll be able to reserve it without issues.
内容的提问来源于stack exchange,提问作者Alazar Komar

