89 lines
2.6 KiB
Markdown
89 lines
2.6 KiB
Markdown
# Setting Up Cloudflare Tunnel for ABforAbortion Website
|
|
|
|
This guide will walk you through the process of setting up a Cloudflare Tunnel to securely expose your ABforAbortion website to the internet without opening ports on your firewall.
|
|
|
|
## Prerequisites
|
|
|
|
1. A Cloudflare account
|
|
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.
|
|
|
|
## Step 3: Create a Tunnel
|
|
|
|
```bash
|
|
cloudflared tunnel create abforabortion-tunnel
|
|
```
|
|
|
|
This will create a new tunnel and store the credentials in `~/.cloudflared/[TUNNEL-ID].json`.
|
|
|
|
## Step 4: Get Your Tunnel ID
|
|
|
|
```bash
|
|
cloudflared tunnel list
|
|
```
|
|
|
|
Note the tunnel ID - you'll need to update it in the `cloudflared-config.yml` file.
|
|
|
|
## Step 5: Set Up DNS Records
|
|
|
|
```bash
|
|
# Replace with your actual domain and tunnel ID
|
|
cloudflared tunnel route dns your-tunnel-id abforabortion.com
|
|
cloudflared tunnel route dns your-tunnel-id www.abforabortion.com
|
|
```
|
|
|
|
## Step 6: Update the Configuration File
|
|
|
|
Edit the `cloudflared-config.yml` file:
|
|
|
|
1. Replace `your-tunnel-id` with your actual tunnel ID
|
|
2. Update the hostnames to match your domain
|
|
|
|
## Step 7: Start the Docker Containers
|
|
|
|
```bash
|
|
docker-compose -f docker-compose-with-cloudflare.yml up -d
|
|
```
|
|
|
|
## Step 8: Monitor the Tunnel
|
|
|
|
```bash
|
|
# Check logs
|
|
docker-compose -f docker-compose-with-cloudflare.yml logs -f cloudflared
|
|
|
|
# Check status
|
|
cloudflared tunnel info your-tunnel-id
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
- **Connection issues**: Check if the cloudflared container can access the web container
|
|
- **DNS issues**: Verify DNS records in your Cloudflare dashboard
|
|
- **Authentication issues**: Ensure credentials file exists and is mounted correctly
|
|
|
|
## Security Considerations
|
|
|
|
- The Cloudflare Tunnel provides secure access without exposing your server's IP address
|
|
- All traffic is encrypted between visitors and your origin server
|
|
- Authentication happens via Cloudflare's authentication system
|
|
|
|
For more information, visit the [Cloudflare Tunnel documentation](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/).
|