Cloudflare Tunnel
The easiest way to serve screenshots and videos from your own domain with HTTPS. Free, no ports to open.
Cloudflare Tunnel is the easiest way to put the media service on your own domain, for example https://media.yourserver.com. A small program (cloudflared) runs on your server and connects out to Cloudflare, so:
HTTPS comes from Cloudflare, no certificate to manage.
No inbound port has to be open, not even the media port or port 80.
Your server's IP is not in the file links.
What you need
A domain, bought anywhere (or in Cloudflare: Domains > Buy domain).
A free Cloudflare account.
Administrator access to the machine FXServer runs on.
1. Add your domain to Cloudflare
Skip this step if the domain already shows Active under Domains.
In the Cloudflare dashboard open Domains > Overview in the left menu and click Add domain.
Choose Connect a domain.
Enter your domain without
www(yourserver.com) and continue.Pick the Free plan.
Cloudflare lists the DNS records it found. Check them (your website, email) and continue.
Cloudflare shows two nameservers. Log in where you bought the domain and replace its nameservers with these two. If DNSSEC is on there, turn it off first; you can turn it on again in Cloudflare later.
Wait until the domain shows Active on the Domains page. It usually takes minutes, at most 24 hours, and Cloudflare sends an email when it is done.
2. Create the tunnel
Open Networking > Tunnels in the left menu and click Create Tunnel.
Enter a name, for example
fivem-server, and click Create Tunnel.Under Operating System choose Windows, under Architecture choose 64-bit.
Click the
cloudflared-windows-amd64.msilink on the page and run the installer.Open Command Prompt as Administrator: press Start, type
cmd, right click Command Prompt > Run as administrator.Copy the command on the page with its copy button and run it. It looks like this, with your own long token:
Connection Status changes from "No connection detected yet" to connected. Click Continue.
cloudflared is now a Windows service: it starts with Windows, you do not need to keep a window open.
On a Linux server choose Debian or Red Hat instead and run the commands the page shows.
3. Send a subdomain to the media service
Open Networking > Tunnels and click your tunnel's name.
Open the Routes tab, click Add route and choose Published application.
Fill in:
Subdomain
media
Domain
yourserver.com
Path
Leave empty
Service URL
http://localhost:6174
Click Add route.
6174 is the media port; use your own if you changed tgiann_media_port. Cloudflare creates the DNS record by itself: under the domain's DNS > Records you now see media.yourserver.com with type Tunnel and Proxied.
4. server.cfg
off: Cloudflare already adds HTTPS, so the service does not need its own certificate or port 80.127.0.0.1: the service only answers this machine. You can then close the media port in your firewall. Links handed out earlier with your IP stop working; leave this line out if old links (a phone gallery, MDT photos) must keep working.
Restart the resource: ensure tgiann-fivem-stats-script.
5. Enter the address in the panel
In the panel open Settings > Media storage > Public address, enter https://media.yourserver.com (no / at the end) and click Save changes. New links use it at once. See Settings > Media storage.
6. Check it
Open
https://media.yourserver.com/healthin a browser. It answers"status":"ok"andpublicUrlis your domain.Run
/mediatestin game. The link it prints starts withhttps://media.yourserver.com.The Media page shows the thumbnails.
Limits and problems
The tunnel shows Down under Networking > Tunnels
The cloudflared service is not running. Open Services in Windows, find Cloudflared agent and start it
The tunnel is up but the domain shows a Cloudflare error page
The Service URL port does not match tgiann_media_port, or the resource is stopped
The tunnel never connects
The server must reach Cloudflare outbound on port 7844. Most hosts allow it; ask yours if not
Links still show the IP
Public address is empty or not saved, see step 5
Other ways to get HTTPS (an automatic certificate for the IP, your own certificate, nginx): HTTPS.