Nginx的配置文件位于Nginx安装目录下的conf目录下,nginx.conf为其主要的配置文件,Nginx的主要功能都在该文件中进行配置。
我们先来看下nginx.conf中这一部分的内容:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}详解:
为了优化Nginx的性能,在这部分的配置中还可以加上以下内容:
# 假设当前主机有4个CPU核心 worker_processes 4; worker_cpu_affinity 0001 0010 0100 1000;
我们先来看下nginx.conf中这一部分的内容:
http {
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;原文:https://www.cnblogs.com/yu2006070-01/p/10207152.html