1 nginx 常用模块整理
nginx 常用模块整理
1 http核心模块 ngx_http_core_module
2 访问控制模块 ngx_http_access_module
3 用户认证模块ngx_http_auth_basic_module
4 状态查看模块ngx_http_stub_status_module
5 日志记录模块ngx_http_log_module
6 压缩相关选项ngx_http_gzip_module
7 重定向模块ngx_http_rewrite_module:
8 引用模块ngx_http_referer_module
9 反向代理模块ngx_http_proxy_module
10 代理模块ngx_http_upstream_module模块
2 nginx与apache对比
一般是前面nginx抗并发,后面apache集群。
优点
1 静态资源处理性能高
2 配置简洁
3 负载能力强,抗并发性能好,采用epoll
4 更加轻量,占用更少的内存和资源。
缺点 :
1 处理动态资源能力弱
2 apache更稳定。
3 apache rewirte功能更强。
3 Nginx配置文件结构
全局作用域块
events
http
server
location
4 负载均衡策略
1 轮询
2加权轮询
3 最少连接 :把请求分配到连接数最少的server
4 ip_hash : 请求根据访问ip的hash值分配,这样一台客户端同时发送的多个web请求会被分配到同一个server进行处理,解决了session问题。
网友评论