zoukankan      html  css  js  c++  java
  • Nginx高性能服务器安装、配置、运维 (3) —— Nginx配置详解

     

    四、Nginx 配置详解

    YUM方式安装的Nginx默认配置文件放在/etc/nginx目录下,使用Vim编辑/etc/nginx/nginx.conf:

    --------------------------------------------------

    //全局区

    user nginx;                    # 使用的用户和组
    worker_processes 1;              # 指定工作子进程数(一般等于CPU的总核数或总核数的两倍,例如两个四核CPU,则总核数为8)

    error_log /var/log/nginx/error.log warn;     # 指定错误日志存放的路径,错误日志记录级别可选项为:[ debug | info | notice | warn | error | crit ]
    pid /var/run/nginx.pid;             # 指定 pid 存放的路径

    //事件驱动

    events {
    worker_connections 1024;           # 允许的连接数
    }

    //HTTP

    http {                      #设定http服务器
    include /etc/nginx/mime.types;         #文件扩展名与文件类型映射表
    default_type application/octet-stream;      #默认文件类型

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '    #日志文件Main格式
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

    access_log /var/log/nginx/access.log main;   #设定日志文件

    sendfile on;                    #sendfile 指令指定 nginx 是否调用 sendfile 函数,一般为on,除非用于下载等应用
    #tcp_nopush on;                

    keepalive_timeout 65;               #连接超时时间

    #gzip on;                     #开启gzip压缩

    include /etc/nginx/conf.d/*.conf;        #包含其它配置文件,如自定义的虚拟主机
    }

    --------------------------------------------------

    (本文由kayvan编辑发表,内容主要收集于互联网,转载请注明出处:http://www.cnblogs.com/kayvan

     

  • 相关阅读:
    [转]tf.summary() 用法
    PASCAL VOC工具包解读
    [ERROR] 安装完Detectron后出现 cython_nms.so: undefined symbol: PyFPE_jbuf
    用Tensorflow做蝴蝶检测
    双系统,重装ubuntu后无法进入windows
    [Error]NodeDef mentions attr 'identical_element_shapes' not in Op<name=TensorArrayV3;
    [转]调试 smallcorgi/Faster-RCNN_TF 的demo过程遇到的问题
    js交互轮播图
    js取俩个数之间的随机数
    原生js实现触摸滚动轮播图
  • 原文地址:https://www.cnblogs.com/kayvan/p/3977373.html
Copyright © 2011-2022 走看看