BƯỚC 1: Cài đặt CyberPanel
CyberPanel là một Hosting Panel sử dụng OpenLiteSpeed có tốc độ rất tốt dành cho những người dùng Wordpress
Mã:
sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
Đọc thêm tài liệu tại:
https://docs.cyberpanel.net/doku.php?id=installation

BƯỚC 2: Cài đặt vDDoS Proxy Protection
vDDoS Proxy Protection là free software cung cấp một Reverse Proxy Server giao thức HTTP(S). Nó hoạt động như là một tường lửa ứng dụng chống đỡ DOS, DDOS, SYN Flo***, hoặc HTTP Flo*** attack để bảo vệ website của bạn.

Mã:
curl -L https://github.com/duy13/vDDoS-Protection/raw/master/latest.sh -o latest.sh
chmod 700 latest.sh
bash latest.sh


BƯỚC 3: Change OpenLiteSpeed Default Port

Mặc định CyberPanel sử dụng OpenLiteSpeed chạy trên port 80 và 443, chúng ta có thể cấu hình lại cho Webserver này lắng nghe ở port khác để cho vDDoS có thể proxy vào nó.


Ví dụ mình chuyển OpenLiteSpeed sang port 8080 và 8443:

Mã:
cp /usr/local/lsws/conf/httpd_config.conf.vddosbak
nano /usr/local/lsws/conf/httpd_config.conf

Phần Port 80 chạy HTTP:

Mã:
listener Default {
  address                 *:80
  secure                  0
  map                     voduy.com voduy.com
}
Sửa *:80 thành 127.0.0.1:8080:

Mã:
listener Default {
  address                 127.0.0.1:8080
  secure                  0
  map                     voduy.com voduy.com
}

Và phần Port 443 chạy HTTPS:

Mã:
listener SSL {
  address                 *:443
  secure                  1
  keyFile                 /usr/local/lsws/admin/conf/webadmin.key
  certFile                /usr/local/lsws/admin/conf/webadmin.crt
  map                     voduy.com voduy.com
}
Sửa *:443 thành 127.0.0.1:8443:


Mã:
listener SSL {
  address                 127.0.0.1:8443
  secure                  1
  keyFile                 /usr/local/lsws/admin/conf/webadmin.key
  certFile                /usr/local/lsws/admin/conf/webadmin.crt
  map                     voduy.com voduy.com
}
Nếu bạn không thấy có mục listener SSL {...} như trên thì có thể tự thêm vào cuối file một khung như vậy:

Mã:
listener SSL {
  address                 127.0.0.1:8443
  secure                  1
  keyFile                 /usr/local/lsws/admin/conf/webadmin.key
  certFile                /usr/local/lsws/admin/conf/webadmin.crt
}
Sau này tạo Site chạy SSl CyberPanel sẽ tự động thêm mục "map" domain vào đó cho bạn

Save & Restart OpenLiteSpeed:

Mã:
service lsws restart
Kiểm tra lại OpenLiteSpeed port:

Mã:
[root@vDDoS-CyberPanel ~]# netstat -lntup|grep openlitespeed
[root@vesta ~]# netstat -lntup|grep httpd
tcp        0      0 0.0.0.0:7080            0.0.0.0:*               LISTEN      11507/openlitespeed
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      11507/openlitespeed
tcp        0      0 127.0.0.1:8443          0.0.0.0:*               LISTEN      11507/openlitespeed
udp        0      0 0.0.0.0:32772           0.0.0.0:*                           11576/openlitespeed

BƯỚC 4: Cấu hình vDDoS Proxy Protection

Ví dụ sau, do OpenLiteSpeed đã lắng nghe ở Port 8080 và 8443 ở IP 127.0.0.1 nên mình sẽ Proxy vDDOS vào 127.0.0.1 như sau:

Mã:
nano /vddos/conf.d/website.conf

# Website       Listen               Backend                  Cache Security SSL-Prikey   SSL-CRTkey
default         http://0.0.0.0:80    http://127.0.0.1:8080    no    no      no           no
default         https://0.0.0.0:443  https://127.0.0.1:8443   no    no      /vddos/ssl/your-domain.com.pri /vddos/ssl/your-domain.com.crt
Restart vDDoS service sau khi cấu hình:
Mã:
/usr/bin/vddos restart
Auto-start vDDoS services khi boot:
Mã:
/usr/bin/vddos autostart


BƯỚC 5: Cấu hình vDDoS Auto Add
vDDoS Auto Add là một addon hỗ trợ cho vDDoS Proxy Protection - Theo dõi Domains/Aliasdomains/Subdomains vừa được thêm trong Panel Hosting, Web Server, List Domain, Virtual Host... và tự động add thêm những domain vừa được tìm thấy vào trong file website.conf.

Mã:
nano /vddos/auto-add/setting.conf

Default Setting for vddos-add command:

SSL		Auto
Cache		no
Security	no
HTTP_Listen	http://0.0.0.0:80
HTTPS_Listen	https://0.0.0.0:443
HTTP_Backend	http://127.0.0.1:8080
HTTPS_Backend	https://127.0.0.1:8443
Crontab cho tự động làm việc theo dõi sau mỗi 15 phút scan hệ thống nhận diện những web đã được add trong CyberPanel rồi thì xin SSL Let's Encrypt và thêm vào trong website.conf:
Mã:
echo '*/15 * * * * root /usr/bin/vddos-autoadd panel cyberpanel openlitespeed' >> /etc/crontab


BƯỚC 6: Cấu hình vDDoS Auto Switch
vDDoS Auto Switch là một addon hỗ trợ cho vDDoS Proxy Protection - Tự động nhận diện ra websites quá tải và dịch chuyển Security Mode của website đó một cách tự động trong website.conf

Mã:
echo '*/5 * * * * root /usr/bin/vddos-autoswitch checkalldomain high' >> /etc/crontab
echo '0 */3 * * * root /usr/bin/vddos-autoswitch flushalldomain /vddos/conf.d/website.conf no' >> /etc/crontab
Đọc thêm tài liệu tại:
http://vddos.voduy.com/
https://www.diendanmaychu.vn/showthr...Layer4-Mapping