go build -o routenx ./main.go
pm2 start routenx --name routenxNote
Builds the Go application as an executable named routenx,
then runs it in the background using PM2.
PM2 automatically restarts the process if it crashes and provides monitoring capabilities.
docker build -t routenx .Note
Builds a Docker image tagged routenx, using the current directory as the build context.
docker run -d \
--restart unless-stopped \
-p 80:80 -p 443:443 -p 3000:3000 \
routenxNote
Runs the routenx container in detached mode,
restarts automatically unless stopped,
and maps ports 80, 443, and 3000 to the host.
"port": 80,
"ssl-port": 443,
"web-port": 3000Note
Port 80 is for HTTP, 443 for HTTPS (SSL), and 3000 is used by the Web Console interface.
"ssl": {
"enabled": true,
"testing": true,
"email": "[email protected]",
"domains": [
"example.com",
"sub.example.com"
]
}Warning
Be sure to replace "[email protected]" and "example.com" with your actual email and domain.
SSL certificate generation will fail if these values are invalid.
Tip
When "testing" is set to true, SSL certificates will be requested from Let's Encrypt's staging environment.
This is useful for development and testing because it avoids rate limits.
Set "testing": false for production to obtain real certificates.
Note
Enables SSL and listens on port 443 for HTTPS traffic.
"firewalls": [
{
"name": "cloudflare",
"cidr": [
"173.245.48.0/20",
"103.21.244.0/22",
"... (etc)",
"2c0f:f248::/32"
],
"block": false
}
]Tip
Routes using this firewall rule only accept packets coming through Cloudflare.
"routes": [
{
"host": [
"*.example.com"
],
"firewall": [
"cloudflare"
],
"endpoint": "http://localhost:2222"
}
]Note
Routes traffic from *.example.com to localhost:2222,
and only accepts requests from Cloudflare IPs.