Nginx配置文件nginx.conf有哪些属性模块?

39 阅读1分钟
worker_processes  1;                                    # worker进程的数量
events {                                                  # 事件区块开始
    worker_connections  1024;                            # 每个worker进程支持的最大连接数
}                                                        # 事件区块结束
http {                                                   # HTTP区块开始
    include       mime.types;                            # Nginx支持的媒体类型库文件
    default_type  application/octet-stream;             # 默认的媒体类型
    sendfile        on;                                   # 开启高效传输模式
    keepalive_timeout  65;                               # 连接超时
    server {                                            # 第一个Server区块开始,表示一个独立的虚拟主机站点
        listen       80;                                  # 提供服务的端口,默认80
        server_name  localhost;                           # 提供服务的域名主机名
        location / {                                    # 第一个location区块开始
            root   html;                               # 站点的根目录,相当于Nginx的安装目录
            index  index.html index.htm;                  # 默认的首页文件,多个用空格分开
        }                                                  # 第一个location区块结果
        error_page   500502503504  /50x.html;             # 出现对应的http状态码时,使用50x.html回应客户
        location = /50x.html {                          # location区块开始,访问50x.html
            root   html;                                  # 指定对应的站点目录为html
        }
    }  
    ......