π This article is a translation of the original post published on ITpraktika.com (Bulgarian).
If you own a server β whether a VPS or a home machine β and want to host websites or monitoring tools, security and configuration can quickly become a headache. This post introduces a single Bash script that handles everything for you: from generating strong passwords to spinning up a fully isolated Docker environment.
π‘οΈ What Does This Script Do?
This tool is built for people who want a professional-grade setup with minimal effort. It automates:
- Cloudflare Tunnel β Connects your server to Cloudflare's network without opening ports 80 or 443 on your router or firewall. Your server stays invisible to bots and scanners.
- Uptime Kuma β Installs one of the best open-source monitoring tools for tracking your sites and services.
- WordPress support β Optionally spins up to 2 independent WordPress sites, each with its own isolated database.
- Maximum security β Generates unique 24-character passwords for every component and sets proper file permissions on all config files.
- Healthchecks β Intelligently waits for MariaDB to be fully ready before starting your sites, preventing startup race conditions.
π οΈ How to Use It
The entire setup takes less than a minute. SSH into your Linux server and run these three commands:
1. Download the script:
wget https://gist.fedia.eu/urocibg/8edf74d152594176a1052308054ed36c/raw/HEAD/setup_hosting.sh
2. Make it executable:
chmod +x setup_hosting.sh
3. Run the installer:
./setup_hosting.sh
π What Happens Next?
The script will ask you a few questions β whether you want Uptime Kuma, how many WordPress sites you need, and your Cloudflare tunnel token. Once you answer, it generates:
- An
.envfile containing all your passwords. - A
docker-compose.ymlwith optimized settings. - An initialization SQL script for your databases.
Once you've answered all the questions, the script takes care of the rest β including starting all the containers. Your entire infrastructure will be online automatically. π
Note: This script is an ideal solution for developers and sysadmins looking for the right balance between cost, security, and ease of maintenance.
Original article (Bulgarian): https://itpraktika.com/hosting-s-cloudflare-tunnel/
Top comments (0)