<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cloudflared Archives - LinuxTuto</title>
	<atom:link href="https://www.linuxtuto.com/tag/cloudflared/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.linuxtuto.com/tag/cloudflared/</link>
	<description>Linux Sysadmin and DevOps blog</description>
	<lastBuildDate>Mon, 09 Dec 2024 14:32:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.linuxtuto.com/wp-content/uploads/2022/01/cropped-LT_faveicon-32x32.png</url>
	<title>cloudflared Archives - LinuxTuto</title>
	<link>https://www.linuxtuto.com/tag/cloudflared/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">201456972</site>	<item>
		<title>How to Configure Cloudflare Tunnel on Ubuntu 24.04</title>
		<link>https://www.linuxtuto.com/how-to-configure-cloudflare-tunnel-on-ubuntu-24-04/</link>
					<comments>https://www.linuxtuto.com/how-to-configure-cloudflare-tunnel-on-ubuntu-24-04/#respond</comments>
		
		<dc:creator><![CDATA[LinuxTuto]]></dc:creator>
		<pubDate>Mon, 09 Dec 2024 14:30:02 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Cloudflare]]></category>
		<category><![CDATA[cloudflared]]></category>
		<guid isPermaLink="false">https://www.linuxtuto.com/?p=1837</guid>

					<description><![CDATA[<p>Cloudflare Tunnels is a service offered by Cloudflare that allows you to securely expose web services running on your local machine or private network to...</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-configure-cloudflare-tunnel-on-ubuntu-24-04/">How to Configure Cloudflare Tunnel on Ubuntu 24.04</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Cloudflare Tunnels</strong> is a service offered by Cloudflare that allows you to securely expose web services running on your local machine or private network to the internet without needing to open ports, set up firewalls, or use a public IP address.</p>
<p>It creates a secure, encrypted tunnel between your origin server and Cloudflare’s network, enabling access to your applications from anywhere.</p>
<p>In this tutorial we will show you how to configure Cloudflare Tunnel on Ubuntu 24.04.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Step 1: Install and Configure Cloudflared</span></h2>
<p>To create and manage tunnels, you will need to install and authenticate <strong>cloudflared</strong> on your server.</p>
<p>You can install <strong>cloudflared</strong> with the following command:</p>
<pre><code># wget -q wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
# dpkg -i cloudflared-linux-amd64.deb</code></pre>
<p>After installing <strong>cloudflared</strong>, you need to authenticate it with your Cloudflare account:</p>
<pre><code># cloudflared tunnel login</code></pre>
<p>You will get the following message:</p>
<pre><code>Please open the following URL and log in with your Cloudflare account:
https://dash.cloudflare.com/argotunnel?aud=&callback=https%3A%2F%2Flogin.cloudflareaccess.org%2F94jJEwKkBV3dOOKv5oPBEj-B9lWITbj_Gk_9sVN1wnw%3D
Leave cloudflared running to download the cert automatically.</code></pre>
<p>Copy the URL and log in to your Cloudflare account. Once you logged in you will get the following message:</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter wp-image-1838 size-large" src="https://www.linuxtuto.com/wp-content/uploads/2024/12/autorize_tunnel-900x386.webp" alt="Cloudflare Tunnel Authorize" width="900" height="386" srcset="https://www.linuxtuto.com/wp-content/uploads/2024/12/autorize_tunnel-900x386.webp 900w, https://www.linuxtuto.com/wp-content/uploads/2024/12/autorize_tunnel-300x129.webp 300w, https://www.linuxtuto.com/wp-content/uploads/2024/12/autorize_tunnel-768x329.webp 768w, https://www.linuxtuto.com/wp-content/uploads/2024/12/autorize_tunnel-1536x659.webp 1536w, https://www.linuxtuto.com/wp-content/uploads/2024/12/autorize_tunnel-1222x524.webp 1222w, https://www.linuxtuto.com/wp-content/uploads/2024/12/autorize_tunnel-897x385.webp 897w, https://www.linuxtuto.com/wp-content/uploads/2024/12/autorize_tunnel-684x293.webp 684w, https://www.linuxtuto.com/wp-content/uploads/2024/12/autorize_tunnel.webp 1914w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<p>Click on the Authorize button to authorize the tunnel. <code>Cloudflare</code> will download a certificate file to authenticate <code>cloudflared</code> with <code>Cloudflare’s</code> network.</p>
<pre><code>You have successfully logged in.
If you wish to copy your credentials to a server, they have been saved to:
/root/.cloudflared/cert.pem</code></pre>
<p>Once authorization is completed successfully, your cert.pem will be download to the default directory.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Step 2: Create a Cloudflare Tunnel</span></h2>
<p>Now, you are ready to create a Cloudflare Tunnel that will connect cloudflared to Cloudflare’s edge. Running the following command will create a Tunnel:</p>
<pre><code># cloudflared tunnel create yourtunnel</code></pre>
<p><strong>Note: </strong>Replace <code class="cx qc qd qe pu b">yourtunnel</code> with a name of your choice.</p>
<p>Next, you need to configure the tunnel to point to your local web server. The configuration file contains keys and values, which is written in YAML syntax.</p>
<pre><code># nano /root/.cloudflared/config.yml</code></pre>
<p>You have to include the correct tunnel ID and credentials file gotten from the tunnel creation command.</p>
<pre><code>tunnel: b8294c45-9cd1-40fe-b8f1-519da5d8dfd9
credentials-file: /root/.cloudflared/b8294c45-9cd1-40fe-b8f1-519da5d8dfd9.json
</code></pre>
<pre><code>ingress:
- hostname: test.yourdomain.com
service: http://localhost:80
- service: http_status:404</code></pre>
<p>Next, you have to configure your DNS settings on your <code>Cloudflare</code> account by adding a CNAME record.</p>
<p>Also, you can use this command will generate a CNAME record that points to the subdomain of a specific Tunnel.</p>
<pre><code># tunnel route dns b8294c45-9cd1-40fe-b8f1-519da5d8dfd9 test.yourdomain.com</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 3: Start and Manage the Cloudflare Tunnel</span></h2>
<p>By default, the tunnel expects to find the configuration file in the default directory, <strong>/root/.cloudflared/config.yml</strong> but to run tunnel as a service, you might need to move the <strong>config.yml</strong> file to the <strong>/etc/cloudflared/</strong> directory.</p>
<pre><code># mkdir /etc/cloudflared/
# mv /root/.cloudflared/config.yml /etc/cloudflared/</code></pre>
<p>Then, you have to install the tunnel as a service:</p>
<pre><code># cloudflared service install</code></pre>
<p>Now, we can start and enable the cloudflared service so that it runs in the background and starts automatically upon server boot.</p>
<pre><code># systemctl start cloudflared
# systemctl enable cloudflared</code></pre>
<p>You can verify the status of the cloudflared service using the <strong>systemctl status</strong> command:</p>
<pre><code># systemctl status cloudflared</code></pre>
<pre>Output:
<code>● cloudflared.service - cloudflared
Loaded: loaded (/etc/systemd/system/cloudflared.service; enabled; preset: enabled)
Active: active (running)
Main PID: 2316 (cloudflared)
Tasks: 7 (limit: 2218)
Memory: 14.0M (peak: 16.1M)
CPU: 9.227s
CGroup: /system.slice/cloudflared.service
└─2316 /usr/bin/cloudflared --no-autoupdate --config /etc/cloudflared/config.yml tunnel run</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 4: Add more services (optional)</span></h2>
<p>If we have multiple services using the same tunnel, you have to create separate CNAME entries for each hostname.</p>
<pre><code># cloudflared tunnel route dns &lt;UUID or NAME&gt; test2.yourdomain.com</code></pre>
<p>Then Add another ingress point to the config:</p>
<pre><code>ingress:
- hostname: test.yourdomain.com
service: http://localhost:80
- hostname: test2.yourdomain.com
service: http://localhost:8080
- service: http_status:404</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Comments and Conclusion</span></h2>
<p>That’s it. You have successfully Configure <code>Cloudflare</code> tunnel on Ubuntu 24.04</p>
<p>For additional help or useful information, we recommend you to check  <a href="https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/" target="_blank" rel="noopener">the official Cloudflare Tunnel documentation.</a></p>
<p>If you have any questions please leave a comment below.</p>
<p>r</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-configure-cloudflare-tunnel-on-ubuntu-24-04/">How to Configure Cloudflare Tunnel on Ubuntu 24.04</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.linuxtuto.com/how-to-configure-cloudflare-tunnel-on-ubuntu-24-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1837</post-id>	</item>
	</channel>
</rss>
