#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;
# }
#}
}
nginx.conf配置文件解析
最新推荐文章于 2025-08-29 14:28:40 发布
1079

被折叠的 条评论
为什么被折叠?



