Nginx默认配置语法
1. 我们进入 /etc/nginx/目录下,打开 nginx.conf文件
2. 我们来解析下 这里面标签和各模块的作用
# 设置nginx服务的系统使用用户 user nginx; # 设置工作进程数,一般设置为 主机的cpu数量 worker_processes 1; # 有关nginx错误日志的目录文件 error_log /var/log/nginx/error.log warn; # nginx启动时候pid pid /var/run/nginx.pid; events { # 每个进程允许的最大连接数 worker_connections 1024; } http { include /etc/nginx/mime.types; 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 /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; #设置客户端和服务端的超时时间为 65秒 keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; }