您的位置:首页 > 运维架构 > Nginx

LNMP环境中nginx配置详解

2018-04-08 17:34 197 查看
user  www www;          #配置用户或者组
worker_processes auto;  #允许生成的进程数

error_log  /home/wwwlogs/nginx_error.log  crit;  #指定日志路径

pid        /usr/local/nginx/logs/nginx.pid;  #指定nginx进程运行文件存放地址
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events
    {   
        accept_mutex on;             #设置网络连接序列化,防止惊群现象发生,默认为on
        use epoll;                   #事件驱动模型
        worker_connections 51200;    #最大连接数,默认为512
        multi_accept on;             #设置一个进程是否同时接受多个网络连接,默认为off
    }

http
    {
        include       mime.types;      #文件拓展名和文件类型映射表
        default_type  application/octet-stream;   #默认文件类型

        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;    #客户端请求头部的缓冲区大小
        large_client_header_buffers 4 32k;   #客户请求头缓冲区的大小
        client_max_body_size 50m;       #设定通过nginx上传文件大小

        sendfile   on;                 #允许sendfile方式传输文件,默认为off
        tcp_nopush on;  //此选项允许或禁止使用socke的TCP_CORK的选项,此选项仅在使用sendfile的时候使用

        keepalive_timeout 60;          #连接超时时间,默认为75s
  fastcgi_connect_timeout 300;          #自定义格式
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 256k;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: