Nginx基本属性配置
1.找到安装目录下conf 文件下的nginx.conf文件 通过 Notepad++打开进行 属性配置

image

image
2.worker_processes 1;跟cpu数有关
3.events {
#nginx最大负载量
worker_connections 1024;
}
4.include* mime.types;*

image
5.server :http结构下可以有多个server。请求进来 确定 使用哪一个 server由 server_name 确定

image
6.location :一个server下可以有多个location ,用来匹配 同一个域名下不同uri的访问
root 表示本地的根目录 ,可以写相对路径 也可以写绝对路径如 e:/nginx/html ;
index :访问主页 后面如果跟有多个页面 则会依次判断 如果第一个不存在 则向后匹配;
proxy_pass :转发 后跟系统地址

image
7.location匹配原则

image

image

image
Nginx的优化
1.worker_processes :工作进程

image
2.worker_cpu_affinity**

image
3.worker_rlimit_nofile

image
4.events;
worker_connections:最大并发量;
maxClient:最大可用客户数;
epoll:非阻塞模型 ;

image
5.Http;
access_log :访问日志
error_log: 异常日志 ;
crit:错误级别;

image
6,缓存发送 请求

image
7.最大连接时间

image
8.内容压缩

image
9.静态文件缓存

image
TIP:nginx启动关闭的命令 在nginx安装的目录下
开启 >nginx
关闭>nginx.exe -s stop