worker_processes 1;
error_log /var/log/nginx/error.log warn;
# 以上统称为全局块,
# worker_processes他的数值越大,Nginx的并发能力就越强
# error_log 代表Nginx的错误日志存放的位置
events {
worker_connections 1024;
}
# events块
# worker_connections他的数值越大,Nignx并发能力越强
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
# location块
# root:将接收到的请求根据/usr/share/nginx/html去查找静态资源
# index: 默认去上述的路径中找到index.html或者index.htm
}
# server块
# listen: 代表Nginx监听的端口号
# localhost:代表Nginx接收请求的ip
}
# http块
# include代表引入一个外部的文件 -> /mime.types中放着大量的媒体类型
# include /etc/nginx/conf.d/*.conf; -> 引入了conf.d目录下的以.conf为结尾的配置文件
nginx配置文件nginx.conf命令解释
最新推荐文章于 2024-06-15 13:54:04 发布