Setting Cloudflare CDN for Hosting Website

Setting Cloudflare CDN untuk Hosting Website

  • Server : 103.169.7.159
  • Domain : rainui.cloud
  • Daftar akun Cloudflare (free)
  • Add a Site > masukan nama domain anda > pilih yang Free $0 > secara otomatis agan mendeteksi record domain, tambahkan/sesuaikan record domain dengan IP server
  • Ganti Nameserver domain Anda dengan Nameserver Cloudflare
  • Verifikasi nameserver dengan https://dnschecker.org
  • Pastikan nameserver domain anda sudah berubah menggunakan cloudflare
  • Konfigurasi Cloudflare
  • SSL/TLS > Overview > Flexible > Ceklis SSL/TLS Recommender
  • SSL/TLS > Edge Certificates > Minimum TLS : 1.2
  • Security > Bots > Aktifkan Bot Fight Mode
  • Security > DDoS > Ruleset action: Managed Challenge > Ruleset sensitiviry: Default > Save
  • Security > Settings > Security Level: I’m Under Attack! > Challenge: 15 minutes
  • Network > Aktifkan HTTP/2 , HTTP/2 to Origin , HTTP/3 , 0-RRT Connection Resumption

  • Install web server apache
apt update && apt install apache2 -y
  • Buat directory untuk file website anda
mkdir /var/www/rainui.cloud
  • Setting virtual host untuk domain anda
nano /etc/apache2/sites-available/rainui.cloud.conf
<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName rainui.cloud
     ServerAlias www.rainui.cloud
     DocumentRoot /var/www/rainui.cloud

     <Directory /var/www/rainui.cloud>
        Options Indexes FollowSymLinks
        Require all granted
        DirectoryIndex index.php index.html
        AllowOverride All
        Order allow,deny
        Allow from all

        Header set Access-Control-Allow-Headers "ORIGIN, X-REQUESTED-WITH, CONTENT-TYPE"
        Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, PUT, DELETE"
        Header set Access-Control-Allow-Origin "*"
        Header set Access-Control-Allow-Credentials true
        Header set X-XSS-Protection 1;mode=block
        Header set X-Frame-Options SAMEORIGIN
        Header set X-Content-Type-Options nosniff
        Header set Strict-Transport-Security "max-age=15552000; includeSubDomains;preload"
        Header set Referrer-Policy strict-origin-when-cross-origin
        Header set Access-Control-Max-Age 60000
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
  • Aktifkan konfigurasi virtual host
a2enmod rewrite
a2enmod headers
a2ensite rainui.cloud.conf
systemctl restart apache2

Pengujian

  • Test dns record dan akses website anda
  • Domain anda sudah menggunakan IP Cloudflare

herdiana3389

A system administrator with skills in system administration, virtualization, linux, windows, networking, cloud computing, container, etc.