User Tools

Site Tools


installing_and_configuring_cloudflared_on_an_lxc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
installing_and_configuring_cloudflared_on_an_lxc [2024/08/26 12:20] – created osoinstalling_and_configuring_cloudflared_on_an_lxc [2024/10/17 21:42] (current) – external edit 127.0.0.1
Line 2: Line 2:
  
 ==== 1. Download and Install Cloudflared ==== ==== 1. Download and Install Cloudflared ====
-  Download the `.deb` package:+  Download the `.deb` package:
 <code> <code>
 wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
 </code> </code>
  
-  Install the package using `dpkg`:+  Install the package using `dpkg`:
 <code> <code>
 sudo dpkg -i cloudflared-linux-amd64.deb sudo dpkg -i cloudflared-linux-amd64.deb
 </code> </code>
  
-  Verify the installation:+  Verify the installation:
 <code> <code>
 cloudflared --version cloudflared --version
Line 18: Line 18:
  
 ==== 2. Authenticate Cloudflared with Cloudflare ==== ==== 2. Authenticate Cloudflared with Cloudflare ====
-  Run the following command to log in and create a tunnel:+  Run the following command to log in and create a tunnel:
 <code> <code>
 cloudflared tunnel login cloudflared tunnel login
 </code> </code>
-  The authentication process will prompt you to open a URL in your browser to log in with your Cloudflare account.+  The authentication process will prompt you to open a URL in your browser to log in with your Cloudflare account.
  
 ==== 3. Create a New Tunnel ==== ==== 3. Create a New Tunnel ====
-  Create the tunnel and give it a name:+  Create the tunnel and give it a name:
 <code> <code>
 cloudflared tunnel create my-tunnel cloudflared tunnel create my-tunnel
 </code> </code>
  
-  Note the tunnel ID and the location of the `cert.pem` file, which will be used for routing traffic.+  Note the tunnel ID and the location of the `cert.pem` file, which will be used for routing traffic.
  
 ==== 4. Configure the Tunnel to Route Traffic ==== ==== 4. Configure the Tunnel to Route Traffic ====
-  Create a configuration file:+  Create a configuration file:
 <code> <code>
 sudo nano /etc/cloudflared/config.yml sudo nano /etc/cloudflared/config.yml
 </code> </code>
-  Example configuration:+  Example configuration:
 <code> <code>
-tunnel: 72a29ddd-7ef4-46e3-97ef-cc4d8e3fc2ba+tunnel: 72a29ddd==== TUNNEL ====cc4d8e3fc2ba
 credentials-file: /home/facundo/.cloudflared/72a29ddd-7ef4-46e3-97ef-cc4d8e3fc2ba.json credentials-file: /home/facundo/.cloudflared/72a29ddd-7ef4-46e3-97ef-cc4d8e3fc2ba.json
  
Line 49: Line 49:
  
 ==== 5. Run the Tunnel ==== ==== 5. Run the Tunnel ====
-  Start the tunnel:+  Start the tunnel:
 <code> <code>
 sudo cloudflared tunnel run my-tunnel sudo cloudflared tunnel run my-tunnel
 </code> </code>
-  Ensure the tunnel is active and routing traffic correctly.+  Ensure the tunnel is active and routing traffic correctly.
  
 ==== 6. Configure NGINX on Raspberry Pi ==== ==== 6. Configure NGINX on Raspberry Pi ====
-  Update the NGINX configuration on your Raspberry Pi to handle requests coming from the tunnel.+  Update the NGINX configuration on your Raspberry Pi to handle requests coming from the tunnel.
  
 ==== 7. Set Up Cloudflared as a Systemd Service ==== ==== 7. Set Up Cloudflared as a Systemd Service ====
-  Create a systemd service file:+  Create a systemd service file:
 <code> <code>
 sudo nano /etc/systemd/system/cloudflared.service sudo nano /etc/systemd/system/cloudflared.service
 </code> </code>
-  Add the following configuration:+  Add the following configuration:
 <code> <code>
 [Unit] [Unit]
Line 80: Line 80:
 </code> </code>
  
-  Enable and start the service:+  Enable and start the service:
 <code> <code>
 sudo systemctl daemon-reload sudo systemctl daemon-reload
Line 86: Line 86:
 sudo systemctl start cloudflared sudo systemctl start cloudflared
 </code> </code>
-  Check the status of the service:+  Check the status of the service:
 <code> <code>
 sudo systemctl status cloudflared sudo systemctl status cloudflared
Line 92: Line 92:
  
 ==== 8. Verify Tunnel Operation ==== ==== 8. Verify Tunnel Operation ====
-  Ensure that the tunnel is running and NGINX is properly handling requests by checking the logs and testing the subdomains.+  Ensure that the tunnel is running and NGINX is properly handling requests by checking the logs and testing the subdomains.
  
 ===== Conclusion ===== ===== Conclusion =====
 Following these steps will ensure that your `cloudflared` tunnel is correctly set up on your LXC and that it integrates smoothly with your existing reverse proxy setup on your Raspberry Pi. Following these steps will ensure that your `cloudflared` tunnel is correctly set up on your LXC and that it integrates smoothly with your existing reverse proxy setup on your Raspberry Pi.
  
installing_and_configuring_cloudflared_on_an_lxc.1724674839.txt.gz · Last modified: 2024/10/17 21:42 (external edit)