Last active
February 15, 2022 04:23
-
-
Save JokerCatz/1ea3f8e26ed28c964057b1ac60049774 to your computer and use it in GitHub Desktop.
cloudflare tunnel guide
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## install tools | |
# doc at https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation | |
## no domain at cloudflare | |
# https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/run-tunnel/trycloudflare | |
## has domain at cloudflare | |
# browser login cloudflare and enable "Zero Trust" , need add payment (card / paypal with $0) | |
# then tunnel doc at https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide | |
> cloudflared tunnel login | |
# will open browser to link account , then create ~/.cloudflared folder & add auth key | |
## default tunnel config | |
# example domain name use `testme.example.org` | |
> cloudflared tunnel create testme.example.org | |
# will show UUID and create json at ~/.cloudflared , UUID like `2cd35e9c-2d7b-4ade-b140-92024e17390f` | |
# > cloudflared tunnel list # list all tunnels | |
# > cloudflared tunnel delete <name or uuid> # delete tunnel | |
# create default config file ~/.cloudflared/config.yaml | |
#==== BODY : ~/.cloudflared/config.yaml | |
url: http://localhost:8080 | |
tunnel: 2cd35e9c-2d7b-4ade-b140-92024e17390f | |
credentials-file: /<HOME>/.cloudflared/2cd35e9c-2d7b-4ade-b140-92024e17390f.json | |
#====/BODY | |
# the `credentials-file` need full path , like `/root/.cloudflared/2cd35e9c-2d7b-4ade-b140-92024e17390f.json` | |
# then link tunnel to domain name | |
> cloudflared tunnel route dns testme.example.org testme.example.org | |
# then use tunnel , and keep the process , next time only need execute this | |
> cloudflared tunnel run | |
## custom tunnel config | |
# the default config name 'config' , you can add new config like | |
> cloudflared tunnel create testme2.example.org | |
# create custom config file ~/.cloudflared/testme2.yaml | |
> cloudflared tunnel route dns testme2.example.org testme2.example.org | |
> cloudflared tunnel run testme2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment