基础概念
simple directives:以';'结尾的指令
block directive:由括号包裹的simple directives
context:本身是block directive,并且能够包含block directive的指令(events, http, server, and location)
main context:不在任何context里的指令属于main context(event,http属于main context,location的context是server,server的context是http)
403forbidden错误排查
nginx没有权限访问目录
检查自定义的配置文件
nginx -p . -tc ./conf/nginx.conf #非默认位置,需要用-p
c++ fastcgi
简单实验
简单负载均衡
user nginx nginx; worker_processes 5; events { worker_connections 4096; ## Default: 1024 } http { upstream backend { server 127.0.0.1:2333; server 127.0.0.1:2334; server 127.0.0.1:2335; } # This server accepts all traffic to port 80 and passes it to the upstream. # Notice that the upstream name and the proxy_pass need to match. server { listen 80; location / { proxy_pass http://backend; } } }
nginx docker启动
#nginx docker启动 docker run --name nginx-test -v /var/log/nginx/:/var/log/nginx/ -v /etc/nginx/:/etc/nginx/ -p 80:80 -d nginx