Detailed Cloudflare Configuration Guide for Hong Kong Servers

Detailed Cloudflare Configuration Guide for Hong Kong Servers

Release Time:2024-12-08 02:10:29

1. initial dns setup

 
 
 
 
 
step 1: add domain to cloudflare
1. login to cloudflare dashboard
2. click "add site"
3. enter your domain name
4. select a plan (recommend pro or business for hk sites)
5. import existing dns records or create new ones
 
step 2: update nameservers
1. copy cloudflare nameservers (usually 2)
2. login to domain registrar
3. replace existing nameservers with cloudflare's
4. wait for propagation (usually 24-48 hours)
 

2. ssl/tls configuration

 
 
 
 
 
step 1: access ssl/tls section
1. go to dashboard → ssl/tls
2. select "full (strict)" mode
3. generate dedicated certificate if needed
 
step 2: configure edge certificates
1. set minimum tls version to 1.2
2. enable tls 1.3
3. enable automatic https rewrites
4. configure ssl/tls recommender
 
step 3: enable hsts
1. go to ssl/tls → edge certificates
2. enable hsts
3. set max age header to 6 months
4. check "include subdomains"
5. enable "preload"
 
 

3. performance optimization

 
 
 
 
 
step 1: speed settings
1. go to speed → optimization
2. enable auto minify:
   - javascript
   - css
   - html
3. enable brotli compression
4. enable early hints
5. enable rocket loader
6. enable http/3 (quic)
 
step 2: caching configuration
1. go to caching → configuration
2. set browser cache ttl to 4 hours
3. enable always online
4. configure cache rules:
   - create rule for static content
   - set edge cache ttl
   - enable cache everything for static assets
 
step 3: page rules setup
1. go to rules → page rules
2. add rule: "example.com/static/*"
   - cache level: cache everything
   - edge cache ttl: 1 month
3. add rule: "example.com/images/*"
   - cache level: cache everything
   - edge cache ttl: 1 week
   - auto minify: on
 

4. security configuration

 
 
 
 
 
step 1: firewall settings
1. go to security → waf
2. enable owasp core rule set
3. configure custom rules:
   - block high-risk countries
   - rate limiting rules
   - challenge suspicious ips
 
step 2: ddos protection
1. enable ddos mitigation
2. configure under attack mode:
   - set sensitivity level
   - customize challenge page
3. enable bot fight mode
 
step 3: ip firewall rules
1. whitelist legitimate ips
2. block malicious ip ranges
3. configure geolocation-based rules
 

5. china-specific optimization

 
 
 
 
 
step 1: china network setup
1. enable enterprise china network (if available)
2. configure china-specific dns:
   - add china-specific a records
   - enable dns-only mode for mainland users
 
step 2: performance rules
1. create location-based rules:
   - hong kong: full acceleration
   - mainland china: dns-only or custom routing
2. configure argo smart routing:
   - enable dynamic path optimization
   - set up failover routes
 
step 3: monitoring setup
1. configure analytics:
   - enable all metrics
   - set up email alerts
2. monitor china connectivity:
   - set up uptime monitoring
   - configure latency alerts
 

6. advanced optimization

 
 
 
 
 
step 1: workers implementation
1. create new worker:
   - add response headers optimization
   - implement request routing logic
   - add caching logic
 
step 2: load balancing
1. configure load balancers:
   - add origin servers
   - set up health checks
   - configure failover rules
 
step 3: custom error pages
1. create custom pages for:
   - 502 bad gateway
   - 522 connection timed out
   - 523 origin is unreachable
 
 

7. monitoring and maintenance

 
 
 
 
 
regular checks:
1. daily:
   - check error rates
   - monitor cache hit ratio
   - review security events
 
2. weekly:
   - analyze traffic patterns
   - review waf triggers
   - check ssl certificate status
 
3. monthly:
   - performance audit
   - security rules review
   - update custom rules
 
 
 

8. troubleshooting checklist

 
 
connection issues:
1. check origin server:
   - verify server response
   - check server logs
   - confirm firewall rules
 
2. ssl issues:
   - verify certificate validity
   - check ssl mode compatibility
   - review ssl handshake logs
 
3. performance issues:
   - review cache status
   - check bandwidth usage
   - analyze request patterns
   - monitor origin response times

important notes:

 
  • always test changes in development/staging first
 
  • keep documentation of all configuration changes
 
  • maintain backup of critical settings
 
  • regular review of security rules
 
  • monitor china-specific network conditions
 
  • keep cloudflare support contact information handy
 
  • schedule regular performance reviews
 
  • maintain updated origin server configurations

www.05vm.com