nginx的nginx.conf主文件通用化配置

本文详细介绍了Nginx服务器的配置文件内容,包括工作进程设置、错误日志记录、连接数限制、压缩功能启用等核心配置项。同时,提供了指向Nginx与Lua结合使用的防火墙配置的参考链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



user  nginx;
worker_processes  16;
#worker_cpu_affinity 0000000000000010 0000000000000010 0000000000000100 0000000000001000 0000000000010000 0000000000100000 0000000001000000 0000000010000000 0000000100000000 0000001000000000 0000010000000000 0000100000000000 0001000000000000 0010000000000000 0100000000000000 1000000000000000;
#worker_cpu_affinity 1010101010101010 0101010101010101;
worker_cpu_affinity auto;




error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


worker_rlimit_nofile 35535;


events {
    use epoll;
    worker_connections  10240;
}






http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    #######
    #Charset
    charset utf-8;


    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" "$request_uri"';


    access_log  /var/log/nginx/access.log  main;
    
    #######
    #Core modlue
    sendfile        on;
    #tcp_nopush     on;
    #tcp_nodeny     on;
    keepalive_timeout  65;
    
    ########
    #Gzip module
    gzip  on;
    gzip_disable "MSIE [1-6]\.";  
    gzip_http_version 1.1; 
    
    ########
    #Virtal Server
    include /etc/nginx/conf.d/*.conf;

}


另,这里没有加入nginx+lua的防火墙配置,相关配置参考使用:

https://github.com/loveshell/ngx_lua_waf


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值