user root;worker_processes 1;pid logs/nginx.pid;events {
#### 默认使用epoll
use epoll;
#### 每个worker允许连接的客户端最大连接数
worker_connections 10240;
}
### 6、http 是指令块,针对http网络传输的一些指令配置
http {
}include mime.types;参数名 参数意义
$remote_addr 客户端ip
$remote_user 远程客户端用户名,一般为:’-’
$time_local 时间和时区
$request 请求的url以及method
$status 响应状态码
$body_bytes_send 响应客户端内容字节数
$http_referer 记录用户从哪个链接跳转过来的
$http_user_agent 用户所使用的代理,一般来时都是浏览器
$http_x_forwarded_for 通过代理服务器来记录客户端的ip sendfile on;
tcp_nopush on;#keepalive_timeout 0;
keepalive_timeout 65;gzip on;server {
listen 88;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
}listen 监听端口
server_name localhost、ip、 域名
location 请求路由映射,匹配拦截
root 请求位置
index 首页设置