Nginx主配置文件nginx.conf

  • Post author:
  • Post category:Nginx
  • Page Views 415 阅读

1.Nginx.conf核心配置参数讲解

[root@CentOS7 nginx]# egrep -v "#|^$" conf/nginx.conf              #去掉包含#号和空行的内容
worker_processes 1; #worker进程的数量
events { #事件区块开始
worker_connections 1024; #每个worker进程支持的最大连接数
} #事件区块结束
http { #http区块开始
include mime.types; #支持的媒体类型库文件
default_type application/octet-stream; #默认的媒体类型
sendfile on; #开启高效传输模式
keepalive_timeout 65; #连接超时
server { #第一个server区块开始,表示一个独立的虚拟主机站点
listen 80; #服务端口
server_name localhost; #域名主机名
location / { #location区块开始
root html; #站点的根目录,相当于nginx的安装目录
index index.html index.htm; #默认的首页文件,多个使用空格分开
} #location区块结束
error_page 500 502 503 504 /50x.html; #出现对应的http状态码时,使用50x.html文件响应
location = /50x.html { #location区块开始,访问50x.html
root html; #指定对应的站点目录
} #location区块结束
} #server区块结束
} #http区块结束


「 文章如果对你有帮助,请点个赞哦^^ 」 

0