nginx.conf配置文件解析

#user  nobody; # worker进程身份,默认使用编译时指定值.语法为"user user_name [group_name]"
worker_processes  1; # nginx启用一个worker进程,

#error_log  logs/error.log; # 设置nginx错误日志文件
#error_log  logs/error.log  notice; # 设置nginx错误级别为notice,级别:debug|info|notice|warn|error|crit|alert|emerg,默认为error
#error_log  logs/error.log  info;

#pid        logs/nginx.pid; #pid存放文件

events { #events段Events用于配置IO模型,如epoll、kqueue、select或poll等
    worker_connections  1024; # 每个worker进程的最大连接数
}


http {
    include       mime.types;    # nginx支持的媒体文件类型。相对路径为同目录conf下的其他文件
    default_type  application/octet-stream;      # 默认的媒体类型

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '   # 访问日志的格式
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;   # 启用sendfile传输模式,此模式是"零拷贝"
    #tcp_nopush     on;   # 只在sendfile on时有效。让数据包挤满到一定程度才发送出去,挤满之前被阻塞

    #keepalive_timeout  0;   # keepalive的超时时间
    keepalive_timeout  65;

    #gzip  on;               # 是否启用gzip压缩响应报文

    server {                    # 定义虚拟主机
        listen       80;        # 定义监听套接字
        server_name  localhost; # 定义主机名加域名,即网站地址

        #charset koi8-r;        # 默认字符集

        #access_log  logs/host.access.log  main;         # 访问日志路径

        location / {                        # location容器,即URI的根
            root   html;                    # 站点根目录,即DocumentRoot,相对路径时为<prefix>/html
            index  index.html index.htm;    # 站点主页文件
        }

        #error_page  404    /404.html;      # 出现404 page not fount错误时,使用/404.html页响应客户端

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;      # 出现50x错误时,使用/50x.html页返回给客户端
        location = /50x.html {                        # 定义手动输入包含/50x.html时的location
            root   html;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值