Skip to content
nginx
# 默认为 1,表示开启一个业务进程。
worker_processes  1;

events {
    # 单个业务进程可接收的连接数
    worker_connections  1024;
}

http {
    # 引入 http mime 类型
    include       mime.types;
    # 如果 mime 类型没匹配上,默认为二进制流。
    default_type  application/octet-stream;
    # 开启 linux 的 sendfile 高效网络传输,即数据 0 拷贝。
    sendfile        on;
    # 长连接的有效时间
    keepalive_timeout  65;

    # 虚拟主机配置
    server {
        # 监听的端口号
        listen       80;
        # 域名或主机名
        server_name  localhost;
        # 匹配路径
        location / {
            # 文件根目录
            root   html;
            # 默认页
            index  index.html index.htm;
        }

        # 报错状态码对应的页面
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}