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
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.
Idk how sites work man
Whats a webserver?
Like docker or something?
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
which would you recommend?
Also when downloading a connector, would I use windows?
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.
ill try this
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
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
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)
Host the site
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
oh cause i have a little bit of css & javascript in my site
its not 100% static
wait so
that's fully static still
which trial do i sign up for on nginx if im just using it to host the site
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
oh ok
so would i put my website files into nginx..?
also is it nginx.com?
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?
My vps
Yea
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…
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
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?
Yes
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
oh ok, because it said you need a basic understanding of git, ive never used it in my life
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
Yea I noticed that, most ppl use docker debian and ubuntu and im so lost
Alright
you have a website already created (i.e the html/css/js files for it, and it displays fine locally)?
yea i have a website created
wym locally?
like through the
C://
if you open your html files up locally in your web browser, it shows everything fine kind of thing
Yes
It does
then you should be able to just throw it up on Pages without any issue
Oh alright
ok
so
uh
when i go to git
i made a respiratory, named it & made it private
But i dont know what it means by all this
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?
No i dont
Does it matter if i upload as a zip
Or not
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
oh ok
oh no
that wont work
because
my site is bigger than
5 mb
25
its 3gb
the 25mb limit is per asset, not overall
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
Downloadable assets or something?
uh
wym
I think so
theres like
Hundreds
Of stuff
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
A blog website
Well the frontend of the site is 2gb
Like i dont want to upload all files one by one
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
its a blog page, i got it made by my friend
But would I be able to just use tunnels to run it?
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
ok yea
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
omfg this is so complicated
Can u link the apache site
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
How you setup cloudflared?
Have you created it on CF one dash or via Terminal
One dash zero trust
Welp then I can't really help you
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
Okay that means you haven't really set up the cloudflared application right?
Not rly
Yea
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 hardThats 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?
what do you mean? I assume you mean for Private Networking, how would it know what subnet to route otherwise?
ZT dashboard?
The Zero Trust Dashboard, what you called the "CF One dash", whatever name you prefer for it
oh ok
the site still doesnt work
Is it timeouting?
I have a “127.0.0.1” public hostname & “localhost:80” public host name
with my domain
Uh how do I check that
127.0.0.1 wouldn't work ig really
oh
Or? Nvmd forget it, sorry
Change the http to https
Tunnel is healthy
ok
for both?
This could be the error
You have a redirect loop, it looks like from Cloudflare and not your origin
No just at the application
You only need one public hostname, I would drop the localhost one
Still didnt work
Alright
If it's because of the http.
He is request http ckoudflare settings says https is required but the tunnel wants http etc
Yea still
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
i tried accessing through https, didnt work either
Can you show the network tab?
where is this located
Steg+I and then networking
redirect isn't from origin, no cf-cache-status header
?
Steg+I?
Oh okay
Sorry CTR+shift+I
on the domain page?
German keyboard layout
On the page that is failing the request
Reload page
Is it redirecting from http to https everytime?
uh
where do i check that
Sec
I'm out of bus
alr
So just this is needed?
Ig so
Never used the CF dashboard for doing something like this
Oh
For me better to set it up with the config.yml
idfk ppl just told me to use cf argo tunnels
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
idk how any of it works tho
alright
Ill check
that my friend is a loop
oh
Delete it?
Yea, was there a reason why you created it?
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
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?
Just do Google research and yea that's the same way how I solveproblems or before I do things I don't know
I mean before I came here I watched like abt 10 videos on how to do it
If you're using tunnels that A record isn't required or desired
None helped
At all
oh ok so delete it?
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)
Alright
It works
Thanks
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
Yea idk
It only wasting your time because videos can become out of date quickly.
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
yea Cloudflare's dashboard experience can be rough, things change fast, and there are sharp corners that can cut you
no problem
Reason why I never watch cloudflares tutorials <a:gif_miizuuKekw:912384944842604564>
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.
Yes
But some videos 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
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
Ah okay thanks
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
How you mean?
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?
Error 1033
Prob. Some issues or misconfiguration of the Apache config file
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
Copy paste in ChatGPT he prob. Knows the issue <a:gif_miizuuKekw:912384944842604564>
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 😭😭
<:0010shiba_think:938055335397191690>
What vide have you watched?
i mean like none have helped so far
i tried using a “rewrite” rule
didnt work tho
Okay prob. redirect you did on CF?
Only thing on cf is a https rule
Looks like an apache thing to do with your configuration, nothing CF would do
Yea im not sure
I tried rewriting rule
didnt work
or im just doing something wrong