If you're running a small website or personal project, dealing with DDoS attacks and malicious traffic can feel overwhelming—especially when enterprise-grade protection costs thousands per month. This guide walks you through a practical, affordable security setup combining Hong Kong-based servers with Cloudflare's free tier. You'll learn exactly how to deploy this stack, configure protection rules, and keep your site running smoothly without breaking the bank.
Hong Kong VPS hosting offers a sweet spot for developers who need decent performance without the red tape. No ICP filing required, unlike mainland China servers. Latency to Asian users stays reasonable—usually under 50ms for most of Southeast Asia. Price-wise, you're looking at providers offering solid specs for around $3-5 monthly.
The infrastructure is mature enough that you get reliable uptime without paying premium prices. Content policies are relaxed compared to stricter jurisdictions, making it suitable for testing environments, blogs, and community projects.
Cloudflare's free tier is surprisingly capable. Their global CDN speeds up your site by caching content closer to users. Basic DDoS mitigation handles most volumetric attacks automatically—no configuration needed.
The Web Application Firewall lets you block common exploit attempts like SQL injection and cross-site scripting. SSL certificates come included, so HTTPS just works. Most importantly, proxy mode hides your origin server's IP address, preventing attackers from bypassing Cloudflare and hitting you directly.
Grab a Hong Kong instance from any reputable provider. Minimum specs that'll handle a typical website:
1 CPU core
1GB RAM
25GB SSD storage
1Gbps network port
Once your server is ready, SSH in and get the basics installed:
bash
sudo apt update && sudo apt upgrade -y
sudo apt install nginx php php-fpm php-curl php-gd php-mbstring php-xml unzip git curl -y
sudo systemctl enable nginx
sudo systemctl start nginx
sudo systemctl enable php7.4-fpm
sudo systemctl start php7.4-fpm
Edit the default Nginx site configuration:
bash
sudo nano /etc/nginx/sites-available/default
Replace with this basic setup:
nginx
server {
listen 80;
server_name example.com;
root /var/www/html;
index index.php index.html;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
Restart Nginx and create a test file:
bash
sudo systemctl restart nginx
echo "" | sudo tee /var/www/html/index.php
Visit your server's IP in a browser. If you see the PHP info page, you're good to go.
Sign up at Cloudflare and add your domain. The free plan does everything we need here. You'll get two nameserver addresses—head to your domain registrar and update the NS records to point at Cloudflare.
Back in Cloudflare's DNS settings, create an A record pointing to your Hong Kong server's IP. Make sure the proxy toggle is orange (enabled), not gray. This forces traffic through Cloudflare's network.
Navigate to the SSL/TLS section. Set encryption mode to "Full (strict)" so traffic between Cloudflare and your server stays encrypted. Enable "Always Use HTTPS" to automatically redirect HTTP requests. Turn on HSTS for an extra security layer.
For small-scale projects that don't need heavy computational lifting or complex integrations, this straightforward deployment gets you online fast. 👉 See why Hong Kong VPS paired with Cloudflare makes sense for bootstrapped projects
Head to Security → Firewall Rules in Cloudflare. Create custom rules to block obvious attack patterns:
Expression: (http.user_agent contains "sqlmap") or (http.request.uri.path contains "/wp-login.php")
Action: Block
This catches common scanning tools and brute-force attempts on WordPress login pages. You can find community-maintained rule sets online if you want more comprehensive coverage.
Stop brute-force attacks before they become a problem. Go to Rate Limiting and set thresholds:
Match: http.request.uri.path eq "/login.php"
Threshold: 60 requests per minute
Action: Challenge or Block
Legitimate users rarely hit these limits. Bots trying to guess passwords will.
If you notice persistent scanning from specific addresses, just block them. Firewall → IP Access Rules → Add the offending IP. Simple and effective.
Workers run JavaScript at the edge before requests hit your server. Here's a quick script to block sketchy user agents:
javascript
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const ua = request.headers.get('User-Agent') || ''
const blockedUAs = ['sqlmap', 'nuclei', 'dirbuster']
if (blockedUAs.some(b => ua.includes(b))) {
return new Response('Blocked', { status: 403 })
}
return fetch(request)
}
Deploy this in the Workers dashboard and bind it to your domain. Requests from those tools never reach your server.
This Hong Kong VPS plus Cloudflare setup handles most security threats you'll encounter running small to medium websites. It's not enterprise-grade, but for blogs, forums, side projects, and testing environments, it gets the job done without monthly sticker shock. If your traffic grows or you need deeper analytics and support, Cloudflare's paid tiers are there when you're ready. Until then, this combination keeps your site fast, secure, and affordable. 👉 Get started with reliable Hong Kong hosting that works with this protection strategy