cf tunnels

does anyone know how to setup my site on cloudflare tunnel? I can get the tunnel health but idk how to actually host my site on it
146 Replies
Chaika
Chaika2y ago
Just to make sure you understand, tunnels won't host your site, they just connect/proxy to an existing web server you have on the server you installed the tunnel on. Assuming you do have an existing web server set up, if you set it up via the dashboard, just add a public hostname for it: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/install-and-setup/tunnel-guide/remote/#2-connect-an-application
Via the dashboard · Cloudflare Zero Trust docs
Follow this step-by-step guide to get your first tunnel up and running using Zero Trust.
7fig
7figOP2y ago
Idk how sites work man Whats a webserver? Like docker or something?
Chaika
Chaika2y ago
a web server is like nginx which responds to http requests serving specific assets, with http responses docker is a way to run applications in a containerized way tunnels are just reverse proxies/connectors, as in you install the tunnel to connect to something else already running on your machine
7fig
7figOP2y ago
which would you recommend? Also when downloading a connector, would I use windows?
Chaika
Chaika2y ago
If you have html/css/js (a static site) that you want to serve, Cloudflare Pages would be a better fit, https://developers.cloudflare.com/pages/get-started/guide/ https://developers.cloudflare.com/pages/framework-guides/deploy-anything/ Please note though Pages cannot execute php, host wordpress, or anything like other then static sites or a few javascript frameworks, if that is your end goal then you'd have to find a host.
7fig
7figOP2y ago
ill try this
Chaika
Chaika2y ago
There's a few youtube tutorials as well for Cloudflare Pages I believe, if you need more of a walk through. I'd just keep in mind within the past few months the dashboard for Pages was overhauled, and if any of them tell you to create a new Pages app, you'd want to go to Workers & Pages => Overview => Create application => select Pages, and then it's mostly the same
7fig
7figOP2y ago
wait uh so if i were to jjst use a tunnel it would work too right if my site is mostly html & a little bit of javascript
Chaika
Chaika2y ago
use a tunnel to what? You could set up nginx to serve your assets for example, and use your tunnel to connect to that. Just in case it's worth clarifying though, that'd require your tunnel and the server running nginx to be on 24/7 (or well, on for whenever you want your site to be accessed)
7fig
7figOP2y ago
Host the site
Chaika
Chaika2y ago
the advantage of Pages is that your website would be served from every one of Cloudflare's 250+ locations, 24/7, and scale to infinity, and if your website is fully static it's free and unlimited
7fig
7figOP2y ago
oh cause i have a little bit of css & javascript in my site its not 100% static wait so
Chaika
Chaika2y ago
that's fully static still
7fig
7figOP2y ago
which trial do i sign up for on nginx if im just using it to host the site
Chaika
Chaika2y ago
nginx is software you would install locally and run, it's not a paid service or anything, they have some paid offerings but it's nothing you would want to use
7fig
7figOP2y ago
oh ok so would i put my website files into nginx..? also is it nginx.com?
Chaika
Chaika2y ago
nginx would be something you run locally on a server do you have a server or anything like that, that you would keep running to serve your website?
7fig
7figOP2y ago
My vps Yea
Chaika
Chaika2y ago
then yea you can set up nginx and make it serve your website assets, following a tutorial like this: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-22-04 (if not using ubuntu, find one for your OS, nginx is really popular, there's a ton of tutorials and guides for it if you look) Then you would set up your tunnel to point at your local nginx server, by creating a new public hostname (can use the guide I linked way above, this would remove the need for you to setup ssl/tls on your nginx web server itself) I would still recommend using Cloudflare Pages unless you're dead set on using your vps. Simple static websites (i.e that is, sites that are just css/js/html, not php or anything server-side) are its bread and butter, and having your website served from 350+ locations, with unlimited static requests is way faster and more scalable
How To Install Nginx on Ubuntu 22.04 | DigitalOcean
Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. In th…
7fig
7figOP2y ago
Alright Does it work on windows or? The reason I dont rly want to try pages is cause it uses git, i just feel like its more complicated But if u rly do recommend it ima try it rn
Chaika
Chaika2y ago
trust me it is 100% not more complicated lol, you don't even need to use Git, you can just direct upload a zip of your websites files (although I would recommend using git anyway, because if you do use direct upload you need to upload all of your files each time you make a change) Is your VPS running Windows?
7fig
7figOP2y ago
Yes
Chaika
Chaika2y ago
If it is, usually you'd use apache on windows, nginx does exist for windows but I've never used it before or know how good the port for it is. Most server guides/etc you will find are going to be around Linux distributions like Ubuntu or Debian. Setting up nginx with tunnels would still be more complex then Pages
7fig
7figOP2y ago
oh ok, because it said you need a basic understanding of git, ive never used it in my life
Chaika
Chaika2y ago
you can just use direct upload and upload a zip of your websites files. imo learning git is worth the investment, but if you really don't want to, you don't need to
7fig
7figOP2y ago
Yea I noticed that, most ppl use docker debian and ubuntu and im so lost Alright
Chaika
Chaika2y ago
you have a website already created (i.e the html/css/js files for it, and it displays fine locally)?
7fig
7figOP2y ago
yea i have a website created wym locally? like through the C://
7fig
7figOP2y ago
Chaika
Chaika2y ago
if you open your html files up locally in your web browser, it shows everything fine kind of thing
7fig
7figOP2y ago
Yes It does
Chaika
Chaika2y ago
then you should be able to just throw it up on Pages without any issue
7fig
7figOP2y ago
Oh alright ok so uh when i go to git
7fig
7figOP2y ago
7fig
7figOP2y ago
i made a respiratory, named it & made it private But i dont know what it means by all this
Chaika
Chaika2y ago
you want to use Git/Github? You created the repository and set it private, does it have all of your websites files in it already or no?
7fig
7figOP2y ago
No i dont Does it matter if i upload as a zip Or not
Chaika
Chaika2y ago
Then don't follow the git stuff, just direct upload. Go to your cloudflare dashboard, Workers & Pages -> overview, Create application (top right), click on the Pages tab, and then upload assets, magic link: https://dash.cloudflare.com/?to=/:account/pages/new/upload Give it a name, and create the project, and then select the folder with your website in it (or zip it up first, and select that), and then upload and deploy https://developers.cloudflare.com/pages/platform/direct-upload/#drag-and-drop
7fig
7figOP2y ago
oh ok oh no that wont work because my site is bigger than 5 mb 25 its 3gb
Chaika
Chaika2y ago
the 25mb limit is per asset, not overall
7fig
7figOP2y ago
I forgot, that was the reason i was even trying to use tunnel anyways Yea but There are assets Which are 1 gb 200 mb etc
Chaika
Chaika2y ago
Downloadable assets or something?
7fig
7figOP2y ago
uh wym I think so theres like Hundreds Of stuff
Chaika
Chaika2y ago
What are the files larger then 25 mb? What kind of site are you trying to setup? For example, You can use Pages for all the actual website assets, and then R2 (Cloudflare's s3-compatable storage) for serving larger files, it has a pretty generous free tier
7fig
7figOP2y ago
A blog website Well the frontend of the site is 2gb Like i dont want to upload all files one by one
Chaika
Chaika2y ago
what kind of website is it? you downloaded it from a generator or something? No website is going to have files 200 mb more in size they serve to visitors unless it's server-side stuff or downloadable stuff like exe's/etc (they wouldn't be website assets) The reason why I ask is that it sounds like whatever you downloaded is more likely to be something that uses a server-side framework, like php to run, then a static site
7fig
7figOP2y ago
its a blog page, i got it made by my friend But would I be able to just use tunnels to run it?
Chaika
Chaika2y ago
Tunnels don't run or host anything. They're like doordash, they connect Cloudflare to a web server you configure. Doordash doesn't make you food, but they do deliver the result to you, tunnels don't run or host anything, but they do deliver the response from a configured service to you, and solve issues like port forwarding/dynamic IPs and remove the need for you to configure encryption/ssl on your web server The answer is basically sure as long as you can configure an actual web server behind the tunnel that does all of the work and serves the website for you
7fig
7figOP2y ago
ok yea
Chaika
Chaika2y ago
You can find tutorials on how to setup apache on windows to serve static files, and then you would point your tunnel at it. I would ask your friend in more help in setting up the site though, it doesn't seem like a simple static site if it has files larger then 200 mb, if it is a blog site with comments or the ability to add posts/etc through the website itself (anything dynamic), it would require something more then a simple web server
7fig
7figOP2y ago
omfg this is so complicated Can u link the apache site
7fig
7figOP2y ago
7fig
7figOP2y ago
yo can someone help me out with this, i literally cant find a good yt tutorial idfk why Ive got apache setup but idfk what to do next Directed myself to “localhost:80” and the “it works” thing showed up anybody on to help? Aight I got my website up on apache server, but now I need it on my domain so people can access it
Akama Aka
Akama Aka2y ago
How you setup cloudflared? Have you created it on CF one dash or via Terminal
7fig
7figOP2y ago
One dash zero trust
Akama Aka
Akama Aka2y ago
Welp then I can't really help you
7fig
7figOP2y ago
Well I havent set it up yet all I have is the apache web server working on my localhost localhost:80 if i use a terminal, will it work too with hosting onto my domain
Akama Aka
Akama Aka2y ago
Okay that means you haven't really set up the cloudflared application right?
7fig
7figOP2y ago
Not rly Yea
Chaika
Chaika2y ago
If you can access it via http://127.0.0.1:80, then just create a new Public Hostname in the ZT Dashboard under your tunnel, using service http 127.0.0.1:80 If you haven't created the tunnel yet, do that and install the connectors, it's not too hard
Akama Aka
Akama Aka2y ago
Thats how I host almost my whole infra but with ZT Warp it began to be useless with some things @chaika.me one question so out of topic. Why is it required to enter a subnetmask at warp zt?
Chaika
Chaika2y ago
what do you mean? I assume you mean for Private Networking, how would it know what subnet to route otherwise?
7fig
7figOP2y ago
ZT dashboard?
Chaika
Chaika2y ago
The Zero Trust Dashboard, what you called the "CF One dash", whatever name you prefer for it
7fig
7figOP2y ago
oh ok
7fig
7figOP2y ago
Akama Aka
Akama Aka2y ago
7fig
7figOP2y ago
the site still doesnt work
Akama Aka
Akama Aka2y ago
Is it timeouting?
7fig
7figOP2y ago
I have a “127.0.0.1” public hostname & “localhost:80” public host name with my domain Uh how do I check that
7fig
7figOP2y ago
Akama Aka
Akama Aka2y ago
127.0.0.1 wouldn't work ig really
7fig
7figOP2y ago
oh
Akama Aka
Akama Aka2y ago
Or? Nvmd forget it, sorry
7fig
7figOP2y ago
Akama Aka
Akama Aka2y ago
Change the http to https
7fig
7figOP2y ago
Tunnel is healthy ok for both?
Akama Aka
Akama Aka2y ago
This could be the error
Chaika
Chaika2y ago
You have a redirect loop, it looks like from Cloudflare and not your origin
Akama Aka
Akama Aka2y ago
No just at the application
Chaika
Chaika2y ago
You only need one public hostname, I would drop the localhost one
7fig
7figOP2y ago
Still didnt work Alright
Akama Aka
Akama Aka2y ago
If it's because of the http. He is request http ckoudflare settings says https is required but the tunnel wants http etc
7fig
7figOP2y ago
Yea still
Chaika
Chaika2y ago
The reason why you use 127.0.0.1 over localhost is because localhost could mean either ipv4 (127.0.0.1) or ipv6 (::1) loopback, and sometimes people only configure ipv4 which can get confusing
7fig
7figOP2y ago
i tried accessing through https, didnt work either
Akama Aka
Akama Aka2y ago
Can you show the network tab?
7fig
7figOP2y ago
where is this located
Akama Aka
Akama Aka2y ago
Steg+I and then networking
Chaika
Chaika2y ago
redirect isn't from origin, no cf-cache-status header
7fig
7figOP2y ago
? Steg+I?
Akama Aka
Akama Aka2y ago
Oh okay Sorry CTR+shift+I
7fig
7figOP2y ago
on the domain page?
Akama Aka
Akama Aka2y ago
German keyboard layout aniblobsweat On the page that is failing the request
7fig
7figOP2y ago
Akama Aka
Akama Aka2y ago
Reload page
7fig
7figOP2y ago
Akama Aka
Akama Aka2y ago
Is it redirecting from http to https everytime?
7fig
7figOP2y ago
uh where do i check that
Akama Aka
Akama Aka2y ago
Sec I'm out of bus
7fig
7figOP2y ago
alr
7fig
7figOP2y ago
7fig
7figOP2y ago
So just this is needed?
Akama Aka
Akama Aka2y ago
Ig so Never used the CF dashboard for doing something like this
7fig
7figOP2y ago
Oh
Akama Aka
Akama Aka2y ago
For me better to set it up with the config.yml
7fig
7figOP2y ago
idfk ppl just told me to use cf argo tunnels
Chaika
Chaika2y ago
That's fine, CF Dashboard is def the better way of configuring tunnels these days. The redirect loop is https -> https, with no cf-cache-status header. Tunnel redirect loops are a bit weird, shouldn't be influenced by your ssl/tls setting. I would guess that you have a misconfigured redirect rule, in the Cloudflare dashboard under Page Rules or Redirect Rules, do you have any redirects configured? https://dash.cloudflare.com/?to=/:account/:zone/rules
7fig
7figOP2y ago
idk how any of it works tho alright Ill check
7fig
7figOP2y ago
Chaika
Chaika2y ago
that my friend is a loop
7fig
7figOP2y ago
oh Delete it?
Chaika
Chaika2y ago
Yea, was there a reason why you created it?
7fig
7figOP2y ago
someone told me to add that a while ago 😭 Ye i was tryna set it up myself and looked for some help, my friend told me to add it & it would work idk ill remove it Now the site just isnt loading? Nvvm
7fig
7figOP2y ago
Chaika
Chaika2y ago
I would wager when you deleted the duplicate public hostname it took the cname record it created for you, with it what do you see under DNS Records?
Akama Aka
Akama Aka2y ago
Just do Google research and yea that's the same way how I solveproblems or before I do things I don't know
7fig
7figOP2y ago
7fig
7figOP2y ago
I mean before I came here I watched like abt 10 videos on how to do it
Chaika
Chaika2y ago
If you're using tunnels that A record isn't required or desired
7fig
7figOP2y ago
None helped At all oh ok so delete it?
Chaika
Chaika2y ago
I would delete that A Record, and then navigate back to the Zero Trust dashboard and recreate the public hostname (so it remakes the tunnel dns record for you, easiest way)
7fig
7figOP2y ago
Alright It works Thanks
Chaika
Chaika2y ago
yea, with some things like this, you're not going to find material on it. The dashboard really shouldn't let you create two public hostnames for the same hostname, I don't see why it would ever be helpful, and then if it does, it shouldn't delete the record when you delete one, just dashboard being silly
7fig
7figOP2y ago
Yea idk
Akama Aka
Akama Aka2y ago
It only wasting your time because videos can become out of date quickly.
7fig
7figOP2y ago
ppl do diff things i noticed that when watching vids, i guess it just messed with my settings Thanks so much Oh yea definetly I prefer ACTUAL live support, because you can recognize the issues quickly Thanks so much
Chaika
Chaika2y ago
yea Cloudflare's dashboard experience can be rough, things change fast, and there are sharp corners that can cut you no problem MeowHeartCloudflare
Akama Aka
Akama Aka2y ago
Reason why I never watch cloudflares tutorials <a:gif_miizuuKekw:912384944842604564>
Chaika
Chaika2y ago
I mean cloudflare's actual guides on developers.cloudflare.com are updated most of the time, and videos can still be helpful, just have to be mindful that things shift locations.
Akama Aka
Akama Aka2y ago
Yes But some videos hehe the marketing team or content creation team to make a CF Datacenter room tour like Google did Could be interesting x3 Oh I see you're just a community champ shyyDead
Chaika
Chaika2y ago
I am yea, not CF employee, CF doesn't have datacenters either, they just colocate in existing ones, the most you'd see is their racks if they gave a tour I imagine, should probably move to #off-topic though and stop cluttering this thread
Akama Aka
Akama Aka2y ago
Ah okay thanks
7fig
7figOP2y ago
Hey so, the website works great now. But, in the directory in the website url, it says “https://kenyssoftware.net/bockze.com/index.html/ how do i remove the directories? its like that for any page i go onto
Akama Aka
Akama Aka2y ago
How you mean?
7fig
7figOP2y ago
So I only want it to be “https://kenyssoftware.net/“ on the main page without the %e2 thing either idfk what that is so it should look like: kenyssoftware.net/ not “/blockze.com/index.html cause those are the folders the site is in, idk why it shows that in the url Anybody on?
Akama Aka
Akama Aka2y ago
Error 1033 Prob. Some issues or misconfiguration of the Apache config file
7fig
7figOP2y ago
Oh no, thats just an example im using a completely diff domain For the site for confedentiality Yea im tryna find a fix idk how
Akama Aka
Akama Aka2y ago
Copy paste in ChatGPT he prob. Knows the issue <a:gif_miizuuKekw:912384944842604564>
7fig
7figOP2y ago
I asked None if it worked Or im just doing it wrong Cause its like Not an actual human explanation So i cant rly ask questions which it will reevaluate & answer Otherwise all my problems would be fixed 😭😭
Akama Aka
Akama Aka2y ago
<:0010shiba_think:938055335397191690> What vide have you watched?
7fig
7figOP2y ago
i mean like none have helped so far i tried using a “rewrite” rule didnt work tho
Akama Aka
Akama Aka2y ago
Okay prob. redirect you did on CF?
7fig
7figOP2y ago
Only thing on cf is a https rule
Chaika
Chaika2y ago
Looks like an apache thing to do with your configuration, nothing CF would do
7fig
7figOP2y ago
Yea im not sure I tried rewriting rule didnt work or im just doing something wrong

Did you find this page helpful?