nginx 安全配置

#拒絕user-agent爲Go的訪問返回403並且不記錄日誌

location / {

if ($http_user_agent ~* Go) {
    access_log off;
    return 403;
} 

#訪問後綴是.php等擴展名結尾的頁面時返回403

location ~* \.(ini|cfg|dwt|lbi|php|zip|rar)$ {
    return 403;
    }

#nginx訪問限速
在http標籤中增加以下內容
limit_req_zone $binary_remote_addr zone=one:20m rate=20r/s;
limit_conn_zone $binary_remote_addr zone=addr:20m;
在server標籤中增加以下內容
limit_conn addr 20;
limit_req zone=one burst=5 nodelay;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章