Configure the domain in Cloudflared; set the DNS addresses in the provider (Route53, NameCheap, GoDaddy, etc.) with the values stablished by Cloudflare.
Download and install the client
https://github.com/cloudflare/cloudflared/releases
or
If using Termux (Android), just install the package
pkg install cloudflared
Install the certificate
cloudflared tunnel login
Copy the path of the generated JSON, it is the credentials-file required in next steps.
cloudflared tunnel create {name}
Modify the config.yml file (example)
tunnel: {uuid}
credentials-file: /path/to/.cloudflared/{uuid}.json
ingress:
- hostname: {domain}
service: http://localhost:{port}
- service: http_status:404
Route the DNS
cloudflared tunnel route dns {tunnel} {domain}
The target domain or subdomain should be used. This step creates the entry in the DNS records.
Start the tunnel
cloudflared tunnel run {tunnel}
Install the service (Not available in Termux)
sudo cloudflared service install
It is possible to link other domains to the tunnel, go to the domain configuration and copy the CNAME entry, the one that has {...}.cfargotunnel.com, add the domain to the config.yml file and configure nginx like this:
http {
...
server {
listen 80 default_server;
server_name firstdomain.com;
...
}
server {
listen 80;
server_name seconddomain.com;
...
}
}
Open source alternatives:
https://github.com/anderspitman/awesome-tunneling
linux net