Jump to content
View in the app

A better way to browse. Learn more.

PHP论坛人

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VPS/雲主機的WAF防火牆

Featured Replies

--------

前言

--------

多數主機商 (如 阿里雲、騰訊雲、AWS、Google Cloud) 都提供免費的WAF防火牆功能,用來協助用戶阻擋未授權的連線與常見攻擊行為

若防火牆規則設定不當,常見會出現以下問題:

服務無法對外提供訪問

合法使用者連線失敗

管理員 (你本人) 被鎖在伺服器外,SSH連不上

本文將以 阿里雲 ECS 與 輕量應用伺服器 SWAS 為例,說明如何啟用WAF防火牆,並設定必要的連接埠規則

雖然各家雲平台的介面略有不同,但核心概念與操作邏輯是共通的

----------------

什麼是WAF?

----------------

WAF (Web Application Firewall) 是一種專門保護網站應用程式的防火牆技術,它能檢查HTTP/HTTPS流量,並依照安全規則過濾惡意請求

有一定規模的主機商通常會在控制台提供WAF防火牆功能,讓用戶自行管理進出流量規則

需要注意的是免費WAF防火牆通常僅提供基礎防護,若遇到大規模攻擊,仍需加購高防禦IP套餐

---------------------------------

如何找到WAF防火牆設定位置?

---------------------------------

以阿里雲為例

阿里雲ECS的WAF路徑:控制台 → ECS 實例 → 選擇實例 → 本實例安全組

此處可設定入站規則 (Inbound) 與出站規則 (Outbound),管理連接埠開放與IP限制

WAF01.png

 

 

阿里雲輕量應用伺服器SWAS的WAF路徑:控制台 → 輕量應用伺服器 → 選擇伺服器 → 安全 → 防火牆

輕量伺服器的WAF防火牆功能較簡易,但仍可進行基本的Port與IP管理

WAF05.png

 

------------------------

常見服務的Port設定建議

------------------------

01.Port.png

補充與建議

網站服務 (80/443) 必須對外開放

管理服務 (SSH、phpMyAdmin 資料庫後台) 不建議全世界開放

能限制IP,就一定要限制IP

WAF防火牆屬於「外層防護」,建議同時在Debian 13啟用系統防火牆 (UFW / iptables / nftables)

後續教學將補充Debian 13使用iptables建立系統防火牆的完整實作

Edited by Jack

Create an account or sign in to comment

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.