帮助中心

这里有最新的使用文档和教程

< 返回

nginx绑定大量域名时需要修改的两个参数

2025-03-15 15:18 作者:31IDC 阅读量:121 所属分类:Linux系统

nginx绑定大量域名时需要修改的两个参数

 

nginx: [warn] could not build optimal server_names_hash, you should increase either server_names_hash_max_size: 512 or server_names_hash_bucket_size: 64; ignoring server_names_hash_bucket_size

 

 

http {

    include       mime.types;

    default_type  application/octet-stream;

 

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                      '$status $body_bytes_sent "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for"';

 

    #access_log  logs/access.log  main;

 

    sendfile        on;

    #tcp_nopush     on;

 

    #keepalive_timeout  0;

    keepalive_timeout  65;

 

    #gzip  on;

 

    # 添加或修改下面2行

    server_names_hash_max_size 4096;

    server_names_hash_bucket_size 1024;

 

    include vhost/*.conf;

 

}

 

31IDC - 12 年深耕海外 IDC 高端资源