Nginx:nginx could not build the server_names_hash 處理方式

2016-02-03 Nginx

這幾天在 Nginx 重啟時出現警告訊息:

 

如果在 Nginx 內有大量的域名定義,或是命名特別長的域名定義,就會產生此警告訊息,遇到這個狀況可以調整 server_names_hash_max_size 和 server_names_hash_bucket_size 這兩個參數

 

一般處置只需要調整 server_names_hash_bucket_size 這個大小就可以解決,預設此值 32 / 64,這取決於你的 CPU cache line size

 

解決方法:

在 nginx.conf 的 http{ } 加上 server_names_hash_bucket_size

$ vim /etc/nginx/nginx.conf

http {
..
server_names_hash_bucket_size 128; 
..
}

128 僅為參考值,實際可自行調整 32、64、128 …

 

 

 

參考資料:

http://nginx.org/en/docs/http/server_names.html

 

 

給 Mr. 沙先生一點建議

彙整

分類

展開全部 | 收合全部

License

訂閱 Mr. 沙先生 的文章

輸入你的 email 用於訂閱