nginx作用:1.http服务,2.反向代理,3.负载均衡
nginx配置:用户进程--链接事件--http链接--server服务器--localtion地址过滤
1.用户、进程数,进程id,日志,
2.事件(最大链接数,网络序列化,驱动,一个进程是否多个链接)
3.http:文件类型,日志,文件传输,链接超时,upstream热备,server,错误页
4.server:单链接请求上限,监听端口,监听地址,location
5.location: url过滤,根目录,设置默认页,请求转向,拒绝ip,允许ip。
nginx反向代理和负载均衡:
##反向代理和负载均衡jabin2017/7/18 ##================================ worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream other { server 192.168.30.83:8098 weight=2; server 192.168.30.83:8099 weight=3; } server { listen 8001; server_name localhost; location / { #proxy_pass http://192.168.30.83:8099; proxy_pass http://other;
proxy_redirect default; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } server { listen 8099; server_name localhost; location / { root E:JabinDOCDemo; index index.html index.htm; } } server { listen 8098; server_name localhost; location / { root E:JabinDOCEndlotteryassets; index lottery.html index.htm; } } }