Apache 核心配置指令中文參考,涵蓋 URL 存取控制、鎖定檔、日誌等級、並發連線限制等關鍵設定。
<Location> 指令<Location URL> ... </Location><Directory>、.htaccess、<Files> 之後/path/(不含 https://servername)scheme://servername/path(需含前綴)? 單字元、* 多字元~ 前綴,如 <Location ~ "/(extra|special)/data"><Location /status>
SetHandler server-status
order deny,allow
deny from all
allow from .foo.com
</Location>
<LocationMatch> 指令 (Apache 1.3+)<Location> 正則版<LocationMatch "/(extra|special)/data">LockFile 指令USE_FCNTL_SERIALIZED_ACCEPT 或 USE_FLOCK_SERIALIZED_ACCEPT 編譯選項需啟用)logs/accept.lock/var/tmp 等全域可寫目錄,防止阻斷服務攻擊LogLevel 指令| 等級 | 意義 | 範例 |
|---|---|---|
| emerg | 系統不可用 | Child cannot open lock file. Exiting |
| alert | 需立即處理 | getpwuid: couldnt determine user name |
| crit | 嚴重錯誤 | socket: Failed to get a socket |
| error | 錯誤 | Premature end of script headers |
| warn | 警告 | child process 1234 did not exit |
| notice | 正常但重要 | httpd: caught SIGBUS |
| info | 資訊 | Server seems busy... |
| debug | 除錯 | Opening config file... |
建議至少設為 crit,指定等級會包含所有更高嚴重性訊息。
MaxClients 指令httpd.h 中 HARD_SERVER_LIMIT 重新編譯ListenBacklog 影響)MaxKeepAliveRequests 指令