update
This commit is contained in:
parent
dcd289e7db
commit
69a92e9656
@ -1,120 +0,0 @@
|
||||
# Setting Up Cloudflare Tunnel for Your Website: A Beginner's Guide
|
||||
|
||||
This guide will walk you through the process of setting up a Cloudflare Tunnel to securely expose your website to the internet without opening ports on your firewall. This is perfect for beginners who want to host a website securely.
|
||||
|
||||
## What is Cloudflare Tunnel?
|
||||
|
||||
Cloudflare Tunnel creates a secure connection between your local web server and Cloudflare's network, allowing visitors to access your site through Cloudflare without exposing your server's IP address.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. A Cloudflare account (free tier works fine)
|
||||
2. A domain registered and using Cloudflare DNS
|
||||
3. Docker and Docker Compose installed on your server
|
||||
|
||||
## Step 1: Install cloudflared CLI
|
||||
|
||||
```bash
|
||||
# For Debian/Ubuntu
|
||||
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
|
||||
sudo dpkg -i cloudflared.deb
|
||||
|
||||
# For other systems, visit: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/
|
||||
```
|
||||
|
||||
## Step 2: Authenticate with Cloudflare
|
||||
|
||||
```bash
|
||||
cloudflared login
|
||||
```
|
||||
|
||||
This command will open a browser window. Log in to your Cloudflare account and authorize the cloudflared application to access your account. This allows the tunnel to connect to your Cloudflare account.
|
||||
|
||||
## Step 3: Create a Tunnel
|
||||
|
||||
```bash
|
||||
cloudflared tunnel create my-website-tunnel
|
||||
```
|
||||
|
||||
This will create a new tunnel and store the credentials in `~/.cloudflared/[TUNNEL-ID].json`. The tunnel ID is a unique identifier for your tunnel.
|
||||
|
||||
## Step 4: Get Your Tunnel ID
|
||||
|
||||
```bash
|
||||
cloudflared tunnel list
|
||||
```
|
||||
|
||||
Note the tunnel ID - you'll need this for the next steps. It should look something like a UUID (e.g., "6ff42ae2-765d-4adf-8112-31c55c1551ef").
|
||||
|
||||
## Step 5: Set Up DNS Records
|
||||
|
||||
```bash
|
||||
# Replace with your actual domain and tunnel ID
|
||||
cloudflared tunnel route dns your-tunnel-id yourdomain.com
|
||||
cloudflared tunnel route dns your-tunnel-id www.yourdomain.com
|
||||
```
|
||||
|
||||
This links your domain name to the tunnel, allowing traffic to flow to your local server.
|
||||
|
||||
## Step 6: Configure Your Tunnel
|
||||
|
||||
Use the provided `cloudflared-config.yml` file and update the following:
|
||||
|
||||
```yaml
|
||||
tunnel: your-tunnel-id # Replace with your actual tunnel ID
|
||||
credentials-file: /root/.cloudflared/your-tunnel-id.json # Update with your tunnel ID
|
||||
```
|
||||
|
||||
Also update the hostname in the ingress section to match your domain:
|
||||
|
||||
```yaml
|
||||
ingress:
|
||||
- hostname: yourdomain.com # Replace with your actual domain
|
||||
service: http://localhost:80
|
||||
```
|
||||
|
||||
## Step 7: Start the Tunnel Using Docker Compose
|
||||
|
||||
We've provided a Docker Compose file that sets up both your web server and the Cloudflare tunnel:
|
||||
|
||||
```bash
|
||||
# Start the services
|
||||
docker-compose -f docker-compose-with-cloudflare.yml up -d
|
||||
|
||||
# Check the status
|
||||
docker-compose -f docker-compose-with-cloudflare.yml ps
|
||||
```
|
||||
|
||||
This will start both your web server and the Cloudflare tunnel service connecting it to the internet.
|
||||
|
||||
## Step 8: Monitor the Tunnel
|
||||
|
||||
```bash
|
||||
# Check logs from your Docker setup
|
||||
docker-compose -f docker-compose-with-cloudflare.yml logs -f cloudflared
|
||||
|
||||
# Check tunnel status using the CLI
|
||||
cloudflared tunnel info your-tunnel-id
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Connection issues**: Check if your web server is running and accessible locally
|
||||
- **DNS issues**: Verify DNS records in your Cloudflare dashboard (orange cloud should be enabled)
|
||||
- **Authentication issues**: Ensure credentials file exists and contains valid information
|
||||
- **"No such tunnel" error**: Double-check your tunnel ID in all configurations
|
||||
|
||||
## Security Benefits
|
||||
|
||||
- Your server's IP address remains hidden from the public
|
||||
- All traffic is encrypted between visitors and your server
|
||||
- Protection from DDoS attacks via Cloudflare's network
|
||||
- No need to open ports in your firewall
|
||||
|
||||
## Next Steps
|
||||
|
||||
- Set up Cloudflare Access for additional authentication
|
||||
- Configure Cloudflare Workers for edge computing capabilities
|
||||
- Explore Cloudflare Pages for static site hosting
|
||||
|
||||
For more information, visit the [Cloudflare Tunnel documentation](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/).
|
48
README.md
48
README.md
@ -4,7 +4,37 @@ This repository contains a framework for deploying static websites exported from
|
||||
|
||||
## Project Motivation
|
||||
|
||||
This project was developed as a cost-effective alternative to webflow's hosting plans. We found that the cost of just a few Webflow hosting subscriptions would equal the expense of purchasing and running a dedicated server for an entire year. For teams managing multiple websites, this approach can offer significant savings while maintaining full control over your deployment environment. It is possible to have a full webflow deployment free and open source.
|
||||
This project was developed as a cost-effective alternative to webflow's hosting plans. We found that the cost of a monthly Webflow hosting subscriptions would equal the expense of purchasing and running a dedicated server for an entire year. To illustrate:
|
||||
|
||||
Webflow Site Plan
|
||||
- CMS = $29.00 USD / Month
|
||||
- Workspace = $28.00 USD / Month
|
||||
- Total = $56.00 USD / Month
|
||||
- Year Total = $672 US 0r $940.56 CAD
|
||||
|
||||
Self-hosted
|
||||
- Hardware = $150
|
||||
- Software = $0
|
||||
- Domain = $10 CAD / Year
|
||||
- Total = $150 / Year
|
||||
|
||||
It is possible to have a full webflow deployment for free and open source.
|
||||
|
||||
## Alternative: Self-Hosted Website Builders
|
||||
|
||||
If you need more functionality than a static Webflow export provides, consider these alternatives:
|
||||
|
||||
### GrapesJS
|
||||
Webflow is built on a framework similar to [GrapesJS](https://grapesjs.com/), an open-source web builder framework. GrapesJS can be self-hosted and integrated with your own backend for dynamic content.
|
||||
|
||||
### Changemaker V5
|
||||
[Changemaker V5](https://gitea.bnkhome.org/bnkops/Changemaker) is a battle-tested, lightweight, self-hosted productivity suite developed by The Bunker Operations in Edmonton, Alberta, Canada.
|
||||
|
||||
It empowers you to deploy secure, locally-built websites, blogs, newsletters, and forms – from personal projects to full-fledged campaigns – giving you complete control, inherent security, and true freedom of speech. It is more the capable of providing the full backend infrastrcuture to a webflow site.
|
||||
|
||||
Changemaker V5 provides a digital campaign alternative to mainstream American systems and can be paired with your own infrastructure at [changemaker.bnkops.org](https://changemaker.bnkops.org).
|
||||
|
||||
|
||||
|
||||
## Webflow Code Export
|
||||
|
||||
@ -88,7 +118,7 @@ For detailed instructions, see the [official Webflow Code Export guide](https://
|
||||
|
||||
6. For public access, you can either:
|
||||
- Configure your DNS and firewall to expose port 80/443
|
||||
- Deploy using the [Cloudflare Tunnel](./CLOUDFLARE-SETUP.md) for secure access
|
||||
- Deploy using the [Cloudflare Tunnel](https://gitea.bnkhome.org/bnkops/scripts/src/branch/main/config.cloudflare.homelab.md) for secure access
|
||||
|
||||
### Management Commands
|
||||
|
||||
@ -136,20 +166,6 @@ The Docker setup uses:
|
||||
- **Port Mapping**: Exposes port 80 for HTTP traffic
|
||||
- **Automatic Restart**: Container restarts automatically if it crashes
|
||||
|
||||
## Alternative: Self-Hosted Website Builders
|
||||
|
||||
If you need more functionality than a static Webflow export provides, consider these alternatives:
|
||||
|
||||
### GrapesJS
|
||||
Webflow is built on a framework similar to [GrapesJS](https://grapesjs.com/), an open-source web builder framework. GrapesJS can be self-hosted and integrated with your own backend for dynamic content.
|
||||
|
||||
### Changemaker V5
|
||||
[Changemaker V5](https://gitea.bnkhome.org/bnkops/Changemaker) is a battle-tested, lightweight, self-hosted productivity suite developed by The Bunker Operations in Edmonton, Alberta, Canada.
|
||||
|
||||
It empowers you to deploy secure, locally-built websites, blogs, newsletters, and forms – from personal projects to full-fledged campaigns – giving you complete control, inherent security, and true freedom of speech.
|
||||
|
||||
Changemaker V5 provides a digital campaign alternative to mainstream American systems and can be paired with your own infrastructure at [changemaker.bnkops.org](https://changemaker.bnkops.org).
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
@ -1,24 +0,0 @@
|
||||
## Cloudflare Tunnel configuration file
|
||||
## This connects your local website to the internet securely without exposing your IP address
|
||||
|
||||
# Tunnel configuration - UPDATE THESE VALUES
|
||||
tunnel: your-tunnel-id # Replace with your actual tunnel ID from Step 4
|
||||
credentials-file: /root/.cloudflared/your-tunnel-id.json # Use your tunnel ID here too
|
||||
|
||||
# Ingress rules define how traffic is routed to your services
|
||||
ingress:
|
||||
# Route traffic from your domain to your local web server
|
||||
- hostname: yourdomain.com # Replace with your actual domain
|
||||
service: http://web:80 # This targets the web service in docker-compose
|
||||
|
||||
# Catch-all rule (required) - returns 404 for any other requests
|
||||
- service: http_status:404
|
||||
|
||||
# Log settings
|
||||
logfile: /var/log/cloudflared.log
|
||||
loglevel: info # Options: debug, info, warn, error, fatal
|
||||
|
||||
# Connection settings
|
||||
originRequest:
|
||||
connectTimeout: 30s
|
||||
noTLSVerify: false # Keep this false for security
|
28
deploy.sh
28
deploy.sh
@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Make the script executable with: chmod +x deploy.sh
|
||||
|
||||
echo "=== AB for Abortion Website Deployment ==="
|
||||
echo "Directory structure:"
|
||||
echo " - website/ - Contains all website files"
|
||||
echo " - nginx.conf - Web server configuration"
|
||||
echo " - docker-compose.yml - Docker configuration"
|
||||
echo "========================================"
|
||||
|
||||
# Stop running containers
|
||||
echo "Stopping any running containers..."
|
||||
docker-compose down
|
||||
|
||||
# Pull the latest nginx image
|
||||
echo "Pulling latest nginx:alpine image..."
|
||||
docker-compose pull
|
||||
|
||||
# Start containers in detached mode
|
||||
echo "Starting containers..."
|
||||
docker-compose up -d
|
||||
|
||||
# Display container status
|
||||
echo "Container status:"
|
||||
docker-compose ps
|
||||
|
||||
echo "Deployment complete! The website should be accessible at http://localhost"
|
@ -1,32 +0,0 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
# Web server - serves your website content
|
||||
web:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- "80:80" # Only exposed locally, not to the internet
|
||||
volumes:
|
||||
- ./website:/usr/share/nginx/html # Your website files go in the "website" folder
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf # Nginx configuration
|
||||
restart: always
|
||||
networks:
|
||||
- web_network
|
||||
|
||||
# Cloudflare tunnel service - connects your website to the internet securely
|
||||
cloudflared:
|
||||
image: cloudflare/cloudflared:latest
|
||||
command: tunnel --config /etc/cloudflared/config.yml run
|
||||
volumes:
|
||||
- ./cloudflared-config.yml:/etc/cloudflared/config.yml:ro # Your tunnel configuration
|
||||
- ~/.cloudflared:/root/.cloudflared:ro # Your tunnel credentials
|
||||
restart: always
|
||||
depends_on:
|
||||
- web # Ensures web service starts first
|
||||
networks:
|
||||
- web_network
|
||||
|
||||
# Network used by both services to communicate
|
||||
networks:
|
||||
web_network:
|
||||
driver: bridge
|
Loading…
x
Reference in New Issue
Block a user