nginx.conf配置文件
首先我们进入到cd etc/nginx.然后通过ls查看nginx目录的相关内容。在nginx目录下,我们需要关注nginx.conf文件,这个文件是我们的主配置文件,cat打开:
cat nginx.conf
# 运行用户,默认是nginx
user nginx;
# nginx进程数,一般设置为和cpu核数一样
worker_processes 1;
# 全局错误日志路径
error_log /var/log/nginx/error.log warn;
# 进程pid路径
pid /var/run/nginx.pid;
events {
# 最大连接数
worker_connections 1024;
}
# 设置http服务器
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;
# 长连接超时时间,单位是秒
keepalive_timeout 65;
#传输时是否压缩,压缩的话需要解压,但是传的大小就小了
#gzip on;
#加载其他的配置文件,一带多
include /etc/nginx/conf.d/*.conf;
}
nginx.conf配置文件
最新推荐文章于 2025-03-30 20:42:40 发布