nginx conf配置

官网: http://www.nginx.org/
源码: https://trac.nginx.org/nginx/browser

配置案列

#user administrator administrators;  #配置用户或者组,默认为nobody nobody。
#worker_processes 2;  #允许生成的进程数,默认为1
#pid /nginx/pid/nginx.pid;   #指定nginx进程运行文件存放地址
error_log log/error.log debug;  #制定日志路径,级别。这个设置可以放入全局块,http块,server块,级别以此为:debug|info|notice|warn|error|crit|alert|emerg
worker_rlimit_nofile 51200; #配置Nginx worker进程最大打开文件数
events {
   
    accept_mutex on;   #设置网路连接序列化,防止惊群现象发生,默认为on
    multi_accept on;  #设置一个进程是否同时接受多个网络连接,默认为off
    #use epoll;      #事件驱动模型,select|poll|kqueue|epoll|resig|/dev/poll|eventport
    worker_connections  1024;    #最大连接数,默认为512
}
http {
   
   include       mime.types;   #文件扩展名与文件类型映射表
   default_type  application/octet-stream; #默认文件类型,默认为text/plain
   server_names_hash_max_size 1024;  
   server_names_hash_bucket_size   512;
   client_header_buffer_size 32k;
   large_client_header_buffers 4 32k;
   client_max_body_size 1024m;
   client_body_buffer_size 10m;
   access_log off; #取消服务日志    
   log_format myFormat '$remote_addr$remote_user [$time_local] $request $status $body_bytes_sent $http_referer $http_user_agent $http_x_forwarded_for'; #自定义格式
    access_log log/access.log myFormat;  #combined为日志格式的默认值
    
    sendfile on;   #允许sendfile方式传输文件,默认为off,可以在http块,server块,location块。
    tcp_nopush on;
    sendfile_max_chunk 100k;  #每个进程每次调用传输数量不能大于设定的值,默认为0,即不设上限。
    keepalive_timeout 65;  #连接超时时间,默认为75s,可以在http,server,location块。
    server_tokens off; # 隐藏版本号
	
  #fastcgi
  fastcgi_connect_timeout 300; #指定NGINX与后端FastCGI server连接超时时间 默认值60s
  fastcgi_send_timeout 300; #指定nginx向后端传送请求超时时间(指已完成两次握手后向fastcgi传送请求超时时间) 默认60s
  fastcgi_read_timeout 300; #指定nginx接受后端fastcgi响应请求超时时间 (指已完成两次握手后nginx接受fastcgi响应请求超时时间) 默认60s
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值